I tried to prove it the following way but got stuck:
Take any two sequences $x_n$ and $y_n$ such that $x_n-y_n\to 0$.
Define $E_n:=[x_n, y_n]\cup [y_n, x_n]$.
$|g(x_n)-g(y_n)|=|\int f\chi_{E_n}d\lambda|$
$|f\chi_{E_n}|\le |f|$ and $\int |f|d\lambda <\infty$. So by the Dominated Convergence Theorem, $\lim_n \int f\chi_{E_n}= \int \lim_n f\chi_{E_n}$.
Given any $\epsilon>0$. There exists $N\in \mathbb N$ such that $\lambda(E_n)<\epsilon$ for all $n>N$.
I'm not sure how to take it from here.