Proof if $f$ is continuous then the preimage is closed. I want to show that if $f: \mathbb{R}\to\mathbb{R}$ is continuous then $f^{-1}(l) = \{x\in\mathbb{R}|f(x) = l\}$ is closed.
I am not sure of my proof as I feel like I am missing a step:
I decided to use sequential continuity and consider a convergent sequence $(x_n)\subset f^{-1}(l)$.
By sequential continuity if $x_n \to L \implies f(x_n) \to f(L) = L'$
I want to say that I am now done - but I think I need to prove that $L \in f^{-1}(l)$, or $L' \in Imf$.
 A: [Note] : As Robert mentioned, it is easier to show that continuity implies inverse of an open set is open which I will use as a Lemma.

Lemma $(1)$ : Consider $(X,d_{X})$ and $(Y,d_{Y})$ metric spaces and let $f : X\longrightarrow Y$. We claim that $f$ is continuous in $X$ if and only if for every open set $G\subseteq Y$, $f^{-1}(G)$ is open in $X$.

Proof :
$(\implies)$ :
Let $G$ be open in $Y$, we have to show that $f^{-1}(G)$ is open in $X$. Let $x_{0}\in f^{-1}(G)\implies f(x)\in G$ and since $G$ is open, then $f(x_{0})$ is an interior point of $G$ that is to say $\exists\varepsilon>0$ such that $N_{\varepsilon}(f(x_{0}))\subseteq G$. By continuity of $f$ at $x_{0}$, $\exists\delta>0$ such that $\forall x\in N_{\delta}(x_{0})\implies f(x)\in N_{\varepsilon}(f(x_{0}))$. We now show that $x\in f^{-1}(G)$, notice that :
\begin{align*}
\text{If}\;x\in N_{\delta}(x_{0})&\implies f(x)\in N_{\varepsilon}(f(x_{0}))\subseteq G \\
&\implies x\in f^{-1}(G),\;\forall x\in N_{\delta}(x_{0})\\
&\implies N_{\delta}(x_{0})\subseteq f^{-1}(G)
\end{align*}
Hence, $x_{0}$ is an interior point of $f^{-1}(G)$ implying that $f^{-1}(G)$ is open in $X$.
$(\impliedby)$ :
We have that $\forall G\subseteq Y$ open, we have that $f^{-1}(G)$ is open in $X$. Let $x_{0}\in X$, we want to show that $f$ is continuous at $x_{0}$. Let $N_{\varepsilon}(f(x_{0}))$ be a neighborhood in $Y$ with $\varepsilon>0$, then since $N_{\varepsilon}(f(x_{0}))$ is open in $Y$, then $f^{-1}(N_{\varepsilon}(f(x_{0}))$ is open in $X$. Now $x_{0}\in f^{-1}(N_{\varepsilon}(f(x_{0}))$ because $f(x_{0})\in N_{\varepsilon}(f(x_{0}))$. Therefore, $x_{0}$ is an interior point of $f^{-1}(N_{\varepsilon}(f(x_{0}))$ which means there exist $\delta>0$ such that $N_{\delta}(x_{0})\subseteq f^{-1}(N_{\varepsilon}(f(x_{0}))$. Therefore, $\forall x\in N_{\delta}(x_{0})$ we have that $x\in f^{-1}(N_{\varepsilon}(f(x_{0}))\implies f(x)\in N_{\varepsilon}(f(x_{0}))$. Hence, $f$ is continuous at $x_{0}$.

Corollary : Consider $(X,d_{X})$ and $(Y,d_{Y})$ metric spaces and let $f : X\longrightarrow Y$. We claim that for every open set $G\subseteq Y$, we have that $f^{-1}(G)$ is open in $X$ if and only if for every closed set $F\subseteq Y$, we have $f^{-1}(F)$ is closed in $X$

Proof : The proof is trivial since it follows from the fact that $f^{-1}(E^{c})=(f^{-1}(E))^{c}$. Thus, if $f : X\longrightarrow Y$ is continuous and $F\subseteq Y$ is closed, then $F^{c}$ is open which implies $f^{-1}(F^{c})$ is open which means $(f^{-1}(F))^{c}$ is open by the $\text{(Lemma)}$ and thus $f^{-1}(F)$ is closed. The reverse implication also follows from that basis.
A: The following shows that $L\in f^{-1}(l)$, which completes the OP's solution.
Since $x_n \in f^{-1}(l)$, we have $f(x_n)=l$, for all $n$. By sequential continuity of $f$,
$$x_n\to L \implies f(x_n)\to f(L)$$
But $f(x_n)$ is the constant sequence $l$, which converges (trivially) to $f(L)$, i.e. $f(L)=l$, so that $f^{-1}(l)=L$, as required.
If you're familiar with the equivalent definition of continuity that the inverse image of a closed set is closed, then you will appreciate this super quick "proof":
Proof: $\{l\}$ is closed in $\mathbb{R}$. QED
