We have for all $z \in [a,b]$,
$$\lim_{\delta \to 0+}\sup\{f(x) :x \in B_\delta(z)\cap[a,b]\} - \lim_{\delta \to 0+}\inf\{f(x) :x \in B_\delta(z)\cap[a,b]\}\\:= \omega_f(z) < \epsilon, $$
and there exists $\delta_z $ such if that $x,y \in B_{2\delta_z}(z)\cap[a,b]$, then $|f(x) - f(y)| < \epsilon$.
Since $[a,b]$ is compact and $\{B_{\delta_z}(z):z \in [a,b]\}$ is an open cover, there is a finite subset of intervals $B_{\delta_k}(z_k)$ where $k = 1, \ldots, n$ and
$$\tag{*}[a,b] \subset \bigcup_{k=1}^n B_{\delta_k}(z_k)$$
For any $x \in [a,b]$ there exists by (*) a $j$ such that $x \in B_{\delta_j}(z_j)$. Let $\delta = \min(\delta_1,\ldots, \delta_n)$ and suppose for $y \in [a,b]$ we have $|y-x| < \delta$. Then we have $|x - z_j| < \delta_j < 2\delta_j$ and
$$|y-z_j| \leqslant |y-x| + |x- z_j| < \delta + \delta_j < 2\delta_j$$
Thus, $x,y \in B_{2\delta_z}(z_j)\cap[a,b]$ and it follows that $|f(x) - f(y)| < \epsilon$.
To summarize, for any $\epsilon > 0$ there exists $\delta > 0$ such that for all $x,y \in [a,b]$ such that $|x-y|< \delta$ we have $|f(x) - f(y)| < \epsilon$.
Finally, for any $x_0 \in (a,b)$ there exists $h_0>0$ such that $B_{h_0}(x_0) \in (a,b)$ since $(a,b)$ is open. Let $h = \min (h_0,\delta/2)$. If $x,y \in B_h(x_0)$, then we have both $x,y \in [a,b]$ and $|x-y|< \delta$, and, hence, $|f(x) - f(y)| < \epsilon$.