In general spaces, this property fails. To see this, consider the set $\mathbb{N}\times\mathbb{N}\cup\{\infty\}$ with the topology $\tau=\{A\subseteq\mathbb{N}\times\mathbb{N}\cup\{\infty\}\vert A\subseteq\mathbb{N}\times\mathbb{N}\lor(\infty\in A\land\exists k\in\mathbb{N}\colon\{(n,m)\colon n,m\ge k\}\subseteq A)\}$. It is easily checked that this is a first-countable topology such that $(n_k,m_k)_k\rightarrow(n,m)$ iff $n_k=n$ and $m_k=m$ for large enough $k$ and $(n_k,m_k)_k\rightarrow\infty$ iff $n_k\rightarrow\infty$ and $m_k\rightarrow\infty$. It is then easy to see that the function $f\colon\mathbb{N}\times\mathbb{N}\cup\{\infty\}\rightarrow\mathbb{R},(n,m)\mapsto\frac{1}{n}+\frac{1}{m},\infty\mapsto0$ is continuous.
Consider $y\in L(f)$ and a sequence $(x_k)_k$ in $\mathbb{N}\times\mathbb{N}\cup\{\infty\}$ containing no convergent subsequence and such that $f(x_k)\rightarrow y$.
If $x_k=\infty$ for infinitely many $k$, $(x_k)_k$ possesses a constant, hence convergent, subsequence, so $x_k=\infty$ for only finitely many $k$ and, by passing to a subsequence, we may WLOG assume that $x_k=(n_k,m_k)$ with $n_k,m_k\in\mathbb{N}$ for all $k$. Then, $(n_k)_k$ and $(m_k)_k$ cannot be both be bounded, since that would mean they only take on finitely many values, whence $(n_k,m_k)_k$ would possess a constant, hence convergent, subsequence by pingeonholing. Since $f(n,m)=f(m,n)$, we may WLOG assume that $(m_k)_k$ is unbounded, so that there is a subsequence $(m_{k_l})_l$ s.t. $m_{k_l}\rightarrow\infty$. Then $(n_{k_l})_l$ is bounded, since otherwise $(n_{k_l},m_{k_l})_l$ possesses a subsequence converging to $\infty$, hence $(n_{k_l})_l$ possesses a constant subsequence by pigeonholing, so that $(n_k,m_k)_k$ ultimately possesses a subsequence of the form $(n,m_{k_{l_i}})_i$ for some fixed $n$. It follows that $y=1/n$. Conversely, the sequence $(n,k)_k$ for a fixed $n$ possesses no convergent subsequence and $f(n,k)\rightarrow1/n$, so that we obtain $L(f)=\{1/n\colon n\in\mathbb{N}\}$, which is not closed in $\mathbb{R}$. (The idea behind this construction is that adding the point $\infty$ precisely makes those sequences convergent that would otherwise testify $0$ to be in $L(f)$.)
On the other hand, I believe the diagonalization argument can be made to work in a large number of cases:
Proposition: If $M$ is a topological space admitting an exhaustion by sequentially compact sets, $N$ is a first-countable topological space and $f\colon M\rightarrow N$ is any function, then $L(f)$ is closed in $N$.
To say that $M$ admits an exhaustion by sequentially compact sets means that there is an ascending chain $K_1\subseteq K_2\subseteq ...$ of sequentially compact subspaces of $M$ such that $\bigcup_{i=1}^{\infty}K_i=M$ and $K_i\subseteq\operatorname{int}K_{i+1}$ for all $i$. This is relevant due to the following
Lemma: Let $M$ be a topological space admitting an exhaustion $K_1\subseteq K_2\subseteq...$ by sequentially compact sets. Then a sequence $(x_n)_n$ in $M$ contains no convergent subsequence iff $(x_n)_n$ is eventually in $K_i^c$ for all $i$.
Proof: To see this condition is necessary, assume there is an $i$ s.t. $(x_n)_n$ is not eventually in $K_i^c$. Then there is a subsequence $(x_{n_k})_k$ contained in $K_i$. Since $K_i$ is sequentially compact, this admits a convergent subsequence $(x_{n_{k_l}})_l$, but this is also a convergent subsequence of the original sequence, contrary to hypothesis. To see sufficiency, assume $(x_n)_n$ contains a convergent subsequence $(x_{n_k})_k$ with limit $x$. By exhaustion, there is an $i$ such that $x\in K_i$. Since $K_i\subseteq\operatorname{int}K_{i+1}$, there is an open neighborhood $U\subseteq K_{i+1}$ of $x$. By convergence, there is a $K$ s.t. $x_{n_k}\in U$ for $k>K$. For each $j=1,...,K$, there is an $i_j$ such that $x_{n_j}\in K_{i_j}$. Thus, $(x_{n_k})_k$ lies in $K_{\max\{i_1,...,i_K,i+1\}}$, contrary to hypothesis.
Proof of the Proposition: Since $N$ is first-countable, it suffices to check that if $(y_n)_n$ is a sequence in $L(f)$ converging to some $y\in N$, then $y\in L(f)$. By definition, for each $n$, we can find a sequence $(x_k^n)_k$, containing no convergent subsequence, such that $f(x_k^n)\rightarrow y_n$ as $k\rightarrow\infty$. Both of these conditions are preserved by passing to a subsequence, so, by the Lemma, we can WLOG assume that $x_k^n\in K_i^c$ for all $n$ and $k\ge i$. Since $N$ is first-countable, there is a local neighborhood base $(U_n)_n$ of $y$. We assume $U_1\supseteq U_2\supseteq...$ WLOG. For each $n$, by definition of convergence, there is a $y_{k_n}$ such that $y_{k_n}\in U_n$. By definition of convergence, there is a $x_{l_n}^{k_n}$ such that $f(x^{k_n}_{l_n})\in U_n$. We also take $l_{n+1}>l_n$ WLOG. Then, $f(x^{k_n}_{l_n})\rightarrow y$ as $n\rightarrow\infty$. Also $x^{k_n}_{l_n}\in K_i^c$ for $l_n\ge i$ by construction, so, by the Lemma, $(x^{k_n}_{l_n})_n$ contains no convergent subsequence, hence $y\in L(f)$, as desired.
Lastly, of course, any manifold admits an exhaustion by sequentially compact sets and is first-countable, so the theorem in particular applies when $M,N$ are manifolds.