Second mean value theorem proof
You're almost there.
Let $\displaystyle h(x) = g(x) \int_a^b f(t) \ dt$. As $g$ is continuous, $h$ is also continuous. Without loss of generality, let $x_1 < x_2$.
By what you've shown above, $\int_a^b f(x)g(x) \ dx$ is a number between $h(x_1)$ and $h(x_2)$. As $h$ is continuous, by the IVP there must be a value $x_0 \in (x_1, x_2)$ such that
$$h(x_0) = \int_a^b f(x)g(x) \ dx$$
That is, there is an $x_0 \in (x_1, x_2) \subset (a,b) \ $ such that
$$ g(x_0) \int_a^b f(x) \ dx = \int_a^b f(x)g(x) \ dx$$