Let the above expression be equal to $\phi$ $$\frac{\tan \phi +1}{\tan \phi-1}=\sqrt{\frac{1+x^2}{1-x^2}}$$ $$\frac{1+\tan^2\phi +2\tan \phi}{1+\tan^2 \phi-2\tan \phi}=\frac{1+x^2}{1-x^2}$$
$$\frac{1+\tan^2\phi}{2\tan \phi }=\frac{1}{x^2}$$ $$\sin 2\phi=x^2$$ $$\phi=\frac{\pi}{4}-\frac 12 \cos^{-1}x^2$$
Where am I going wrong?
Because for $x\neq0$ and $-1\leq x\leq1$ easy to see that: $$0<\frac{\pi}{4}+\frac 12 \cos^{-1}x^2<\frac{\pi}{2}$$ and we obtain: $$\tan\left(\frac{\pi}{4}+\frac 12 \cos^{-1}x^2\right)=\frac{1+\tan\frac{1}{2}\arccos{x^2}}{1-\tan\frac{1}{2}\arccos{x^2}}=$$ $$=\frac{\cos\frac{1}{2}\arccos{x^2}+\sin\frac{1}{2}\arccos{x^2}}{\cos\frac{1}{2}\arccos{x^2}-\sin\frac{1}{2}\arccos{x^2}}=\frac{\sqrt{\frac{1+x^2}{2}}+\sqrt{\frac{1-x^2}{2}}}{\sqrt{\frac{1+x^2}{2}}-\sqrt{\frac{1-x^2}{2}}}=\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}.$$
Your mistake in the last line.
Indeed, since $$\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}>1$$ and from here $$\frac{\pi}{4}<\phi<\frac{\pi}{2},$$ we obtain: $$2\phi=\pi-\arcsin{x^2}=\frac{\pi}{2}+\arccos{x^2}.$$