Maximal ideal in the ring of continuous functions from $\mathbb{R} \to \mathbb{R}$
Consider $\varepsilon: A \to \mathbb R$ given by $\varepsilon (f)=f(0)$. This is a surjective homomorphism with kernel $M$. Since the image is a field, the kernel is a maximal ideal.
If $J \subset A$ contains $M$ properly, then there must be some function $f \in J - M$, i.e., for which $f(0) = a \not= 0$.
Consider $f - a \in M \subset J$: we know $f-a$ is continuous, and evaluated at $0$ it returns $a-a = 0$.
Next, consider that $J$ is closed (as it is an ideal) under addition. Since $f \in J$ and $f-a \in J$, we find that the constant nonzero function $a = f - (f-a) \in J$. Since $a \neq 0$, we also have the continuous (constant) function $1/a \in A$, which means that $J$ contains $a(1/a) = 1$, since ideals are closed under multiplication with any element of the parent ring. But this means that $1 \in J$, so that $J = A$, whence $M$ is maximal as desired.
Your summary of what you need to show is incorrect: you aren't given $a$, $g$, and $f$ and need to find $h$ such that
$$ h (ag + f) = 1$$
Instead, the problem you actually need to solve is that you're given $g$ and need to find $h$, $f$, and $a$ such that
$$ h (ag + f) = 1 \qquad \qquad f(0) = 0$$
As you've already observed solving for $h$ is problematic, you can make life much easier for yourself by picking $h$ to be something simple and then trying to solve for $a$ and $f$.
But even this is making things harder than you need to. You asked to show that $1 \in \langle M,g \rangle$, and you know everything in $\langle M,g \rangle$ is of the form $ag + f$ with $f(0)=0$. So the problem you actually need to solve is, given $g$, to find $a,f$ such that
$$ ag+f = 1 \qquad \qquad f(0)=0$$