Is this solution to a problem concerning the equation $a^2=(m^yn^x)^z$ where $m=a^x$ and $n=a^y$correct?
Unfortunately, that is not correct. Your first step in substituting $m$ and $n$ should give you $$a^2=(a^{xy}a^{xy})^z$$The right hand side is equivalent to $a^{2xyz}$. Therefore, $2=2xyz$ and the result follows.
The expression for $a^2$ would be
$$a^2=((a^x)^y(a^y)^x)^z=(a^{2xy})^z=a^{2xyz}$$
And, assuming that $a$ is positive and is not $1$, $$2=2xyz$$
The correct approach is as follows:
$$m^y = a^{xy}$$ $$n^x = a^{xy}$$
Therefore, $$a^2 = \left(m^y n^x\right)^z = \left(a^{xy} a^{xy}\right)^z = \left(a^{2xy}\right)^z = a^{2xyz}.$$
Consequently, $$2 = 2xyz$$ which implies that $$xyz = 1.$$