Your part of the proof shows that for $|x|,|y|>M$, any $\delta$ would do! In fact no matter how far are $x$ and $y$ from each other, if they lie in the region outside $[a,M]$ the difference in the images is going to be smaller than $2\epsilon$, as you said.
Now, you need to fix the region $[a,M]$. There is a general result saying that a continuous function on a compact set is uniformly continuous (Heine's theorem). That gives you the answer (and the $\delta$ you were looking for).
For Heine's theorem, you can argue as follows by contradiction: let $f$ be a continuous function on a compact set which is not absolutely continuous. Then there exists a certain $\epsilon$ such that FOR ALL choiches of $\delta$ the condition is false. If you make successive choices of $\delta=1/k$ you find two sequences of points, $x_k,y_k$, such that $|x_k-y_k|<1/k$, but $|f(x_k)-f(y_k)|>\epsilon$. Since the set is compact, we can extract sequences $x_{k_i}$ and $y_{k_i}$ which converge. By construction, they have the same linit $x=y$. Since $f$ is continuous, $0=f(x)-f(y)=\lim f(x_{k_i})-f(y_{k_i})\geq \epsilon$. This is a contradiction.