It is better to solve it this way:
$$\begin{aligned}
1+\sin\alpha+i\cos \alpha &=1+\cos\left(\frac{\pi}{2}-\alpha\right)+i\sin\left(\frac{\pi}{2}-\alpha\right)\\
& \stackrel{*}{=}2\cos^2\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)+i2\sin\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)\cos\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)\\
&=2\cos\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)\left(\cos\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)+i\sin\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)\right)\\
&=2\cos\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)e^{i\left(\pi/4-\alpha/2\right)}\\
\end{aligned}$$
$(*)$, In this step I used the following formulas:
$\cos(2x)=2\cos^2x-1$ and $\sin(2x)=2\sin x\cos x$
In your method, I am not seeing how you get that expression for $\tan\theta$. Rather it should be $\tan\theta=\dfrac{\cos\alpha}{1+\sin\alpha}$. Hence,
$$\tan\theta=\frac{\sin\left(\frac{\pi}{2}-\alpha\right)}{1+\cos\left(\frac{\pi}{2}-\alpha\right)}=\frac{2\sin\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)\cos\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)}{2\cos^2\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)}$$
$$\Rightarrow \tan\theta=\tan\left(\frac{\pi}{4}-\frac{\alpha}{2}\right)$$