Is it assumed in the given proof for the Schoeder-Bernstein theorem that $A$ and $B$ are the ranges of the injective functions $f$ and $g$? Preamble: I'm referring to the proof given in Art of Problem solving to the Schoeder-Bernstein Theorem. Namely, the claim is that

Let $A$ and $B$ be sets and $f: A \to B$, $g: B\to A$ be injective functions. Then there exists a bijective function $h: A \to B$.

Then in order to prove the theorem, a function $h$ is defined as $h = \begin{cases}g^{-1}(a)&: f(a) \text{ is a descendant of a lonely point}\\\ f(a)&: \text{ otherwise}\end{cases}$
My immediate thought was that: What if $g^{-1}(a)$ is not defined? Namely given that $g: B \to A$ is injective, why should necessarily $g[B] = A$? To which I answered an example in a finite case that if the cardinality of $A$ is greater than $B$, and $g$ is injective, then by the pigeonhole principle $f$ cannot be injective. However it is not immediately obvious to me how the case of $A$ and $B$ being countable/uncountable should be handled, as $A$ and $B$ are just sets.
Question: Is it assumed in the aforementioned proof behind the link that $f[A] = B$ and $g[B] = A$? Or does it follow from somewhere else that $g^{-1}(a)$ is necessarily defined, given the portion of the proof up to the definition of the function $h$?

$g^{-1}(a)$ is necessarily defined. $b \in B$ is lonely if $b \notin f[A]$ and is a descendant of $b_0 \in B$ if $(f \circ g)^n(b_0) = b$ for some $n \geq 0$.
So suppose $f(a)$ is a descendant of a lonely point, let's call it $b$, so there is an $n \geq 0$ such that $(f \circ g)^n(b) = f(a)$. $f(a)$ is clearly not lonely, so it must be the case that $n \geq 1$. But then
$$f(a) = f\Bigl(g\bigl((f \circ g)^{n-1}(b)\bigr)\Bigr).$$
The injectivity of $f$ implies $a = g\bigl((f \circ g)^{n-1}(b)\bigr)$, so $a \in g[B]$. (Namely, $g^{-1}(a) = (f \circ g)^{n-1}(b)$.)
