Pull back image of maximal ideal under surjective ring homomorphism is maximal
Your proof does indeed seem to be correct. It is written in a very convoluted way, however. Perhaps you should start with:
Let $J$ be an ideal containing $f^{-1}(M)$. As $f$ is surjective, $f(J)$ is an ideal, and it contains $M$. As $M$ is maximal, either $f(J)=M$ or $f(J)=S$. If $f(J)=M$, then...
Notice that this avoids your imprecision with the "contrary with our assumption", which actually is not contrary to any assumption you made. Also, it cleans up the proof, by making the chain of deduction clearer.
If I may suggest, a cleaner way of proving this is by an altogether different method, bypassing elements. Since $M$ is maximal, $k:=S/M$ is a field. Since $f$ is surjective, its composition with the canonical projection $\bar{f}:R\to k$ is a surjection. This means that $\ker \bar{f}$ is a maximal ideal. Can you compute it?
I think it would be better to deduce this from the more general correspondence theorem.
This says that there is a one-to-one, inclusion-preserving correspondence between the ideals of $S$ and the ideals of $R$ which contain the kernel $K$ of $f$.
This post answered my post here, but for the sake of completion with my post, I include my answer here. It's very similar to yours with some minor changes.
To answer your post: Yes, your proof is correct.
Let $f: R \to S$ be a surjective ring homomorphism.
Let $M$ be maximal, and let $f^{-1}(M) \subset I$ for some ideal $I \subset R$.
Then $M=f(f^{-1}(M)) \subset f(I)$, since $f$ is surjective.
Since $M$ is maximal in $S$, then either $f(I)=M$ or $f(I)=S$.
If $f(I)=M$, then $I \subset f^{-1}(f(I)) =f^{-1}(M)$, hence $I=f^{-1}(M)$.
If $f(I)=S$, then $M \subset f(I)$.
Let $x \in R$. Then $f(x) \in S = f(I)$.
So, there exists $i \in I$ with $f(x)=f(i)$, hence $f(x-i) =0$.
Then $x-i \in f^{-1}(M) \subset I$, hence $x \in I$.
Thus, $I=R$.
So, $f^{-1}(M)$ is a maximal ideal.