Constructing an arithmetic progression so that $\sum_{i=1}^n f(x_i) =0$

Let $n\ge 1$ be given. We may assume w.l.o.g. that $a<b$ and $f(a)<0<f(b)$. By the continuity of $f$, there exists $0<\epsilon<\frac{b-a}2$ such that for all $0< h< \epsilon$, $$ f(a+h)<0<f(b-h). $$ By choosing $\delta>0$ such that $n\delta <\epsilon$, we have that for all $k=0,1,\ldots, n$, $$ f(a+k\delta)<0<f(b-k\delta) . $$ Define $ g(x) = f(x)+f(x+\delta)+\cdots +f(x+n\delta) $ for $a\le x\le b-n\delta$. Then $g$ is continuous with $g(a)<0<g(b-n\delta)$. By IVT, there is $x_0\in (a,b-n\delta)$ such that $$ g(x_0) = f(x_0)+f(x_0+\delta)+\cdots +f(x_0+n\delta)=0, $$ as wanted.