You have started correctly by writing the equations of motion $x(t)$. However, the blocks meet when $x_1+x_2=0$ not when $x_1+x_2=l$ (which is true in the initial position). This is because both $x_1, x_2$ are being measured outwards from the midpoint, so if the oscillations had the same frequency they would meet at the midpoint where $x_1=x_2=0$.
You might also observe that the oscillation frequencies are $\omega_1=\sqrt{\frac{k}{2m}}$ and $\omega_2=2\omega_1$. So the blocks meet when $$x_1+x_2=\frac{l}{2}\cos(\omega_1 t)+\frac{l}{2}\cos(2\omega_1 t) =l\cos(\frac32 \omega_1 t)\cos(\frac12\omega_1 t)=0$$ The faster oscillation becomes zero first, so the earliest time at which they meet is when $$\cos(\frac32 \omega_1 t)=0, \omega_1 t=\frac{\pi}{3}$$ The momenta just before collision are $$m_1u_1=(2m)\dot x_1=-(2m)\omega_1\frac{l}{2}\sin(\omega_1 t)=-m\omega_1 l \frac{\sqrt3}{2}$$ $$m_2u_2=m\dot x_2=-m(2\omega_1)\frac{l}{2}\sin(2\omega_1 t)=-m\omega_1 l \frac{\sqrt3}{2}$$ These momenta are equal and opposite (because $u_1, u_2$ are measured in opposite directions) so they cancel out. The kinetic energy of the blocks is completely wiped out by the collision. Only elastic potential energies remain at this point, which are $$\frac12 kx_1^2=\frac12 k \frac{l^2}{4}\cos^2(\omega_1 t)=\frac{kl^2}{32}$$ $$\frac12(2 k)x_2^2= k \frac{l^2}{4}\cos^2(2\omega_1 t)=\frac{2kl^2}{32}$$ The total elastic PE at this point decreases during the subsequent oscillation, becoming zero at the midpoint, at which KE is maximum. So $$\frac12 (3m)v_m^2=\frac{3kl^2}{32}$$ $$v_m=\frac{l}{4}\sqrt{\frac{k}{m}}$$ $$n=4$$