Given,
$\left(1+x+x^{2}\right)^{n}=1+a_{1} x+a_{2} x^{2}+\ldots+ a_{2 n} x^{2 n} $
$ \Rightarrow \, x\left(1+x+x^{2}\right)^{n}=x+a_{1} x^{2}+a_{2} x^{3}+ \ldots +a_{2 n} x^{2 n+1} $
On differentiating w.r.t. $x$, we get
$(1+ \left.x+x^{2}\right)^{n}+x \cdot n\left(1+x+x^{2}\right)^{n-1}(1+2 x) $
$=1+2 a_{1} x+3 a_{2} x^{2}+\ldots+a_{2 n} \cdot(2 n+1) x^{2 n}$
On putting $x=-1$, we get
$(1-1+1)^{n}-n(1-1+1)^{n-1}(1-2)$
$=1-2 a_{1}+3 a_{2}+\ldots+a_{2 n}(2 n+1) $
$ \Rightarrow \, 1-n(-1)=1-2 a_{1}+3 a_{2}+\ldots+a_{2 n}(2 n+1) $
$ \Rightarrow \, 2 a_{1}-3 a_{2} \ldots-(2 n+1) a_{2 n}=-n $