You are dealing with indefinite integral therefore you have to take into account that while integrating we have to add a constant of integration. To be precise we got that
\begin{align*}
\int 2\sin x\cos x\mathrm dx&=\int 2\sin x\cos x\mathrm dx\\
\int \sin(2x)\mathrm dx&=\int \left(\frac{\mathrm d}{\mathrm dx}\sin^2(x)\right)\mathrm dx\\
-\frac12\cos(2x)+c_1&=\sin^2(x)+c_2\\
-\frac12\cos(2x)&=\sin^2(x)+c
\end{align*}
To determine the constant of integration in this case we can follow your own attempt by expanding the $\cos(2x)$, even though you have made a minor mistake there, term to get
\begin{align*}
-\frac12\cos(2x)&=\sin^2(x)+c\\
-\frac12(1-2\sin^2(x))&=\sin^2(x)+c\\
c&=-\frac12
\end{align*}
We just proved the Half-Angle Formula since we can now conclude that
$$\sin^2(x)=\frac12-\frac12\cos(2x)=\frac{1-\cos(2x)}2$$
Which is basically all what was missing.