Yes, functions can be defined using set-builder notation. But this is not the most common approach.
However, what you have written down is not really well-formed. Let me address this first; then we can end on a positive note.
Compare your expressions with their correct counterparts, so that you may avoid these mistakes in the future (some things are common abuses of notation, but I strongly suggest you get down to writing the tedious full form until you can recognise a well-formed expression within a second):
$$\begin{array}{c|c}
\forall x \in X, \exists! y \in Y|(x,y)\in f &\forall x \in X:\exists! y\in Y: (x,y) \in f\\
f= \{(x,y)|(x\in X)\land(\exists!y \in Y) \land ((x,y)\in f\} & f = \{(x,y) \mid \forall x \in X: \exists! y \in Y: (x,y)\in f\}
\end{array}$$
and a similar problem arises with the expression for $F$.
So, what is usually done is the following. Let $\rm fn$ be the unary predicate given by:
$$\mathrm{fn}(f) = \forall z \in f: (\exists x,y: z = (x,y)) \land (\forall z' \in f: x_z = x_{z'} \to z = z')$$
That is: "$f$ is a collection of ordered pairs $z = (x_z, y_z)$, and each first coordinate $x_z$ is unique in $f$."
Note that we haven't specified the domain or codomain of $f$ yet. We can use the following binary predicates:
\begin{align}
\mathrm{dom}(f,X) &= \mathrm{fn}(f) \land \forall x: (x \in X\leftrightarrow \exists y: (x,y) \in f)\\
\mathrm{cod}(f,Y) &= \mathrm{fn}(f) \land \forall y: ((\exists x: (x,y) \in f) \to y \in Y)
\end{align}
Then we can define the set of functions from $X$ to $Y$, $Y^X$, by:
$$Y^X = \{f \subseteq X \times Y\mid \mathrm{fn}(f) \land \mathrm{dom}(f,X) \land \mathrm{cod}(f,Y)\}$$
where it is not hard to show that $f \subseteq X \times Y$ makes the $\rm cod$ condition a consequence of the other two.
All being formulated in the first-order language of set theory, this is a first-order definition. The tell-tale sign is that we have no need for quantifying over predicates, etc..
Your solution is wrong, because it assumes that there is some sort of additive structure and an order defined on $A$ (by taking $\max B$ and $+$ into account).
This is true if $A$ is a set of integers, or real numbers, but not in general.
Instead try proving something else, the opposite, if $A$ is infinite and $B$ is finite, then $|A\cup B|=|A|$. This is slightly simpler, and you can reduce to the case where $A$ and $B$ are in fact a sets of integers.
Best Answer
Let
$$f(x):=\begin{cases}x< 7\to x,\\x\ge7\to x+1\end{cases}.$$
Then
$$A=\{x\in S:f(x)\}.$$