I want to prove the following version of the Schroeder-Bernstein Theorem. Please tell me if the proof is correct and whether I have overlooked or missed anything.
Theorem. Let $X$, $Y$ and $Z$ be sets. If $X\subseteq Y\subseteq Z$ and $\left|X\right|=\left|Z\right|$, then $\left|Y\right|=\left|Z\right|$.
Proof. Let $f:Z\rightarrow X$ be a bijection. Define $A=Z-Y$ and define a collection $\left\{ A_{n}\right\} _{n\in\mathbb{N}}$ using recursion as follows: $A_{0}=A$ and $A_{n+1}=f\left(A_{n}\right)$ for all $n\in\mathbb{N}$. Define $A^{*}=\bigcup_{n=1}^{\infty}A_{n}$. Consider the restriction function $f|_{A\cup A^{*}}$. It is injective because $f$ is injective and $$f\left(A\cup A^{*}\right)=f\left(A\right)\cup f\left(\bigcup_{n=1}^{\infty}A_{n}\right) =f\left(A\right)\cup\left[\bigcup_{n=1}^{\infty}f\left(A_{n}\right)\right] =\bigcup_{n=1}^{\infty}A_{n} =A^{*}.$$
Hence, $f|_{A\cup A^{*}}$ is surjective. As a result, $\left|A\cup A^{*}\right|=\left|A^{*}\right|$. Let $B=Z-\left(A\cup A^{*}\right)$. Then $Z=\left(A\cup A^{*}\right)\cup B$ and $Y=A^{*}\cup B$. Now define a function $g:\left(A\cup A^{*}\right)\cup B\rightarrow A^{*}\cup B$ by $$g\left(x\right)=\begin{cases} f\left(x\right) & \text{if }x\in A\cup A^{*};\\ x & \text{if }x\in B. \end{cases}$$ Since $A\cup A^{*}$ and $B$ are disjoint and $A^{*}$ and $B$ are disjoint, it is obvious that $g$ is injective. We have $$g\left(\left(A\cup A^{*}\right)\cup B\right) =g\left(A\cup A^{*}\right)\cup g\left(B\right) =A^{*}\cup B.$$ It follows that $g$ is a bijection and as therefore $$\left|Z\right|=\left|\left(A\cup A^{*}\right)\cup B\right|=\left|A^{*}\cup B\right|=\left|Y\right|.$$