First, we show the result for open intervals in $[0,2\pi]$. Let $A = (a,b)$.
$$\left|\int_a^b \cos nx\, dx\right| = \left|\frac{1}{n}(\sin bx - \sin ax)\right| \le \frac{2}{n} \xrightarrow{n\to\infty} 0$$
Now, suppose $A$ is a measurable set in $[0,2\pi]$. Fix some $\epsilon > 0$. There exists an open set $V$ such that $A \subset V$ and $m(V\setminus A) < \epsilon/2$. Since $V$ is open, it is a countable union of disjoint open intervals in $[0,2\pi]$, say $V = \bigcup_{i=1}^\infty A_i$. Clearly, $m(V) = \sum_{i=1}^\infty m(A_i)$. Since $m(V)$ is finite, we can find some $M\in \mathbb N$ suc…