There appear to be two mistakes, both in the last displayed equation. First,
$$\sqrt2\int{1\over z^2+2}dz=\arctan\left(z\over\sqrt2\right)+C=\arctan\left(\tan\theta-1\over\sqrt{2\tan\theta}\right)+C$$
(i.e., the $1\over2$ in from of the arctan didn't belong there). And second, when you convert arctan to arcsin, you really do get $\arcsin(\sin\theta-\cos\theta)$. I don't know how you got $\arcsin(2\sqrt{\sin2\theta}(\sin\theta-\cos\theta))$, but you can see that it's wrong because it does not differ by a constant from $\arctan((\tan\theta-1)/\sqrt{2\tan\theta})$ for all $0\lt\theta\lt\pi/2$, since both equal $0$ at $\theta=\pi/4$, while $\arcsin(2\sqrt{\sin2\theta}(\sin\theta-\cos\theta))=0$ as $\theta\to0$ whereas
$$\arctan\left(\tan\theta-1\over\sqrt{2\tan\theta}\right)\to-{\pi\over2}\quad\text{as }\theta\to0$$
My recommendation is to have another go at the arctan/arcsin conversion, and if you still don't get the right answer, post your work for that part of the derivation and ping me with a comment so I can take a look at it.
(Remark, added after posting: I was offline composing this, and didn't see Hans Lundmark's answer until just now.)
Added in response to OP's comment: It is true that $y=\arctan((\tan\theta-1)/\sqrt{2\tan\theta})$ implies $\tan y=(\tan\theta-1)/\sqrt{2\tan\theta}$, but it is not always true that $\sin2y=2\tan\theta/(1+\tan^2\theta)$ implies $y={1\over2}\arcsin(2\tan\theta/(1+\tan^2\theta))$. More generally, if $f$ is any of the trig functions (sin, cos, tan, etc.), and $g$ is its inverse (arcsin, arccos, arctan, etc.), then $f(g(x))=x$ is always true but $g(f(x))=x$ is not always true. In other words, when converting from arctan to arcsin, you can't work purely formally; you have to consider the ranges and domains of the functions.