I'm not sure what you mean by $A$ and $B$ varying with $y$ in the context of contour lines in the $XZ$ plane (and likewise for $x$ and $YZ$). I'll assume what you mean is that there is a function $z=f(x,y)$ and the first equation describes the relationship between $x$ and $z$ if you hold $y$ fixed and the second equation describes the relationship between $y$ and $z$ if you hold $x$ fixed.
Since the two expressions for $z$ have to be equal, the dependency of the parameters on $y$ in the first equation must be such that a quadratic function of $y$ results for all $x$. Since $\ln x$ takes different values for different $x$, this can only happen if $A$ and $B$ are both quadratic functions of $y$. Thus, the most general form for $z$ compatible with the given conditions is
$$z=(a_2y^2+a_1y+a_0)\ln x+b_2y^2+b_1y+b_0$$
with
$$
\begin{eqnarray}
A&=&a_2y^2+a_1y+a_0\;,\\
B&=&b_2y^2+b_1y+b_0\;,\\
C&=&a_2\ln x+b_2\;,\\
D&=&a_1\ln x+b_1\;,\\
E&=&a_0\ln x+b_0\;.\\
\end{eqnarray}
$$