I found $a_0$ but I am stuck with $a_n$.
In $a_n$ $$ a_n = \frac{1}{\pi} \int_0^{2\pi} x\cos (nx) dx \\ a_n= \frac{1}{\pi} \left [x \left(\frac{\sin(nx)}{n} \right) + \frac{\cos(nx)}{n^2} \right] $$
Now what???
Solution:
$$ a_0=\frac{1}{2\pi} \int_0^{2\pi}x dx \\ a_0=\frac{1}{2\pi}\left(\frac{4\pi^2}{2}\right)\\a_0= \pi \\ a_n=0 \\ b_n=\frac{1}{\pi}\int_0^{2\pi}x\sin(nx)dx \\ bn=\frac{-2\pi n\cos(2\pi n)+sin (2\pi n)}{\pi n^2} \\ bn=-\frac{2}{n} $$
Hence,
$$ f(x)=\pi-2\sum_{n=1}^\infty \frac{1}{n}\sin(nx) \\ x=\pi-2\left(\sin(x)+\frac{1}{1}\sin(2x)+\frac{1}{1}\sin(3x)+...\right) $$
It seems that you do not know integration? This is not an indefinite integral.
You have calculated the antiderivative correctly, you need to take the difference of this between $x=2\pi$ and $x=0$.
$$\frac{1}{\pi}\int_{0}^{2\pi}x\cos(nx)dx = \frac{2\pi n\sin(2\pi n)+\cos(2\pi n)-1}{\pi n^2} = 0$$