You have to be careful. You can not just take the union of the sets.
Consider $A=\{0,1\}$, $B=\{2,3\}$, $C=D=\{0,1,2\}$. Then you have $card(A)=2<3=card(C)$ and $card(B)=2<3=card(D)$ but you can not define an injective function $h:A\cup B=\{0,1,2,3\} \to C\cup D=\{0,1,2\}$.
The trick is to seperate the points of the set with an additional parameter.
Define
$$
h:(A\times\{0\})\cup (B\times \{1\})\to (C\times\{0\})\cup(D\times\{1\})\\
h(x,s)=\begin{cases}
(f(x),0) & s=0\\
(g(x),1) & s=1
\end{cases}
$$
For $(x,s),(y,t)\in (A\times\{0\})\cup (B\times \{1\})$ consider $h(x,s)=h(y,t)$. We get $s=h_2(x,s)=h_2(y,t)=t$, where $h_2$ denotes the second component function of $h$. This implies either $f(x)=h(x,0)=h(y,0)=f(y)$ or $g(x)=h(x,1)=h(y,1)=g(y)$. The injectivity of $f$ and $g$ yields now $x=y$. Together you get $h(x,s)=h(y,t)\Rightarrow (x,s)=(y,t)$, which proves the injectivity of $h$.
We can conclude
$$
card((A\times\{0\})\cup(B\times\{1\}))\leq card((C\times\{0\})\cup(D\times\{1\})).
$$
Since $A\times\{0\}$ and $B\times\{1\}$ are disjoint and $C\times\{0\}$ and $D\times\{1\}$ are disjoint you get
$$
card((A\times\{0\})\cup(B\times\{1\}))=card(A\times\{0\})+card(B\times\{1\})=card(A)+card(B)
$$
and
$$
card((C\times\{0\})\cup(D\times\{1\}))=card(C\times\{0\})+card(D\times\{1\})=card(C)+card(D).
$$
Using the injectivity of $h$ and this equations, we finally get$$
a+b=card(A)+card(B)\leq card(C)+card(D)=c+d.
$$