Write
$$f(x,y)=u(x,y)+i v(x,y),\quad g(\xi,\eta)=a(\xi,\eta)+ib(\xi,\eta)$$
where $u$, $v$, $a$, $b$ are realvalued functions defined in $A$, resp. $B$. Then by definition of $g$ one has
$$a(\xi,\eta)+ib(\xi,\eta)=g(\xi+i\eta)=\overline{f(\xi-i\eta)}=u(\xi,-\eta)-iv(\xi,-\eta)$$
and therefore
$$a(\xi,\eta)=u(\xi,-\eta),\quad b(\xi,\eta)=-v(\xi,-\eta)\qquad\bigl((\xi,\eta)\in B\bigr)\ .$$
It follows that, e.g. $$b_\eta(\xi,\eta)=-v_y(\xi,-\eta)\cdot(-1)=v_y(\xi,-\eta)\ .$$
Since $u$ and $v$ satisfy the CR-equations in the variables $x$ and $y$ we conclude that
$$a_\xi(\xi,\eta)=u_x(\xi,-\eta)=v_y(\xi,-\eta)=b_\eta(\xi,\eta)\ ,$$
and similarly
$$a_\eta(\xi,\eta)=-u_y(\xi,-\eta)=v_x(\xi,-\eta)=-b_\xi(\xi,\eta)\ .$$
This shows that $g$ fulfills the CR-equations in the variables $\xi$ and $\eta$.
But there is also a direct approach, which in my view is simpler and more in tune with a complex world description.
As $f$ is holomorphic in $A$, for each point $z_0\in A$ (held fixed in the following) there is a complex number $C$ such that
$$f(z)-f(z_0)=C(z-z_0)+o(|z-z_0|)\qquad (z\in A, \ z\to z_0)\ .$$
Let a point $w_0\in B$ be given, and put $z_0:=\bar w_0$. Then by definition of $g$ one has
$$g(w)-g(w_0)=\overline{f(\bar w)}-\overline{f(\bar w_0)}=\overline{f(\bar w)-f( z_0)}=\overline{C(\bar w -z_0)+o(|\bar w-z_0|)}\qquad(w\in B)\ .$$
As $|\bar w -z_0|=|w-w_0|$ it follows that
$$g(w)-g(w_0)=\bar C(w-w_0)+o(|w-w_0|)\qquad(w\in B, \ w\to w_0)\ .$$
It follows that $g'(w_0)=\bar C$, and as $w_0\in B$ was arbitrary, we conclude that $g$ is holomorphic in $B$.
This is essentially the open mapping theorem, which states that a holomorphic, non-constant function is always an open map(i.e. it sends open subsets of its domain to open subsets of $\mathbb{C}$).
Now, the reals are a closed subset of $\mathbb{C}$, so if you have a holomorphic map $f: U \to \mathbb{R}$, where $U$ is open and connected, that map is constant; if it wasn't, $f(U)$ should be open in $\mathbb{C}$.
If we drop the assumption that $U$ is connected, then the map is constant at each component of $U$, but those values may be different for each component.
Best Answer
See the Open mapping theorem: the image of an open set in a non-constant holomorphic function is open. No non-empty subset of a line is open, so if the image is contained in a line, the function must be constant.
That said, proving the open mapping theorem may depend on already having results like the one you ask for. In that case your approach is fine.
Here's an informal way of looking at it: pick a point $z$ in the domain of $f$ and reason that sufficiently close to $z$, $f$ is well-approximated by multiplication by $f^\prime(z)$, which is a scale and/or rotation of the complex plane. Hence there must be some direction you can go from $z$ such that $f(z)$ moves away from the line, unless $f^\prime(z)$ is $0$. So if you always stay within a line, $f^\prime(z)$ must always be $0$, i.e. $f$ must be constant. This approach uses no heavy machinery, just basic facts about the derivative.