Suppose $K$ is a metric space. Let $f : K \rightarrow \mathbb{R} \cup \{ -\infty,\infty \}$ be an extended real-valued function defined on $K.$
Show that the following is true.
For each $x \in K,$
$\max \{ L \in [-\infty,\infty]: \exists x_n \rightarrow x, f(x_n)\rightarrow L \} = \inf \{ \sup_{y \in U}f(y) : U \text{ is a neighbourhood of }x \}.$
The equality above appears in page $4032$ of this paper.
My approach:
Let $x_n$ be a sequence converges to $x$ such that $f(x_n)$ converges to $L$. For each open neighbourhood $U$ of $x$, we have $x_n \in U.$ For this $U$, we have $f(x_n) \leq \sup_{y \in U}f(y).$ Then I stuck here.
One direction is already done by you, as for any sequence $\{x_n\}$ converging to $x$ we have that for each neighborhood $U$ of $x$, there is an $N_U$ such that for all $n>N_U$, $x_n\in U$ and so $f(x_n)\leq \sup_{y\in U}\,f(y)$.
For the other direction, we will construct a sequence converging to $x$ whose images converge to $\inf \left\{ \sup_{y \in U}\,f(y)\,:\, U \text{ is a neighborhood of }x \right\}$ as then we so that the above upper bound is attained and so is the maximum of the given set.
The first thing to notice is that $K$ is a metric space and so that $K$ is a $C1$ space, i.e., there is a decreasing sequence of neigborhoods of $x$ $\{V_m\}$ such that for each $m$, $V_m\supseteq V_{m+1}$ and such that for every neighborhood $U$ of $x$ there is some $m_U$ such that $V_{m_U}\subseteq U$. For instance, just take the sequence of open balls $\{B(x,1/m)\}$.
Then, as we have $\sup_{y\in U}\,f(y)\geq \sup_{y\in V_{m_U}}\,f(y)$ (since $V_{m_U}\subseteq U$), we obtain $$\inf \left\{ \sup_{y \in U}\,f(y)\,:\, U \text{ is a neighborhood of }x \right\}=\inf_m \left\{ \sup_{y \in V_m}\,f(y)\right\}\text{.}$$ Hence we can just work with the sequence of neighbohoods $\{V_m\}$.
For each $m$, we can find a sequence $\{x_{m,n}\}_n$ inside $V_m$ such that $\{f(x_{m,n})\}_n$ is a monotonous sequence such that $\lim_{n\to \infty}\,f(x_{m,n})=\sup_{y\in V_m}\,f(y)$. Then, take for each $m$, the $z_m:=x_{m,n_m}$ such that $$\sup_{y \in V_m}\,f(y)-\frac{1}{m}\leq f(z_m)\leq \sup_{y \in V_m}\,f(y)$$ and then we have that $\{z_m\}$ is a sequence such that $z_m\to x$, as for all $m>m_0$, $z_m\in V_m\subseteq V_{m_0}$, and such that $\lim_{m\to \infty}\,f(z_m)=\lim_{m\to\infty}\sup_{y \in V_m}\,f(y)$ by the above inequality. Now, as $\{V_m\}$ is decreasing, $\{\sup_{y \in V_m}\,f(y)\}_m$ is decreasing and so it converges to $\inf_m \left\{ \sup_{y \in V_m}\,f(y)\right\}$, i.e., $$\lim_{m\to\infty}\sup_{y \in V_m}\,f(y)=\inf_m\sup_{y \in V_m}\,f(y)\text{.}$$ Hence $\{z_m\}$ is the desired sequence converging to $x$ whose images converge to the wanted upper bound.