Let $g:A\to\mathbb{R}$ and $*$ be the unique point added to $A$, i.e. $B=A\cup\{*\}$.
"$\Rightarrow$" Let $g':B\to\mathbb{R}$ be the extension of $g$. Put $c:=g'(*)$. We will show that $g-c$ vanishes.
So pick $\epsilon > 0$ and define
$$U=\{b\in B\ |\ |g'(b)-c| < \epsilon\}$$
So $U=f^{-1}(-\infty, \epsilon)$ for $f(b)=|g'(b)-c|$. Since $g'$ is continous then so is $f$ and thus $U$ is open in $B$.
Therefore $C:=B\backslash U$ is compact (being a closed subset of a compact space). Note that $*\not\in C$ since $*\in U$ because $|g'(*)-c|=0<\epsilon$. Thus $C=A\cap C$ and therefore $A\cap C$ is a compact subset of $A$ that satisfies desired properties. This completes the proof. $\Box$
"$\Leftarrow$" Let $c\in\mathbb{R}$ be such that $g-c$ vanishes. Define
$$g':B\to\mathbb{R}$$
$$g'(x)=\begin{cases}
g(x) & \mbox{ if } x\in A \\
c & \mbox{ if } x= *
\end{cases}$$
Obviously $g'$ extends $g$. All that is left is to prove that $g'$ is continous. Can you complete the proof?
So it is enough to prove that if $c\in(a,b)$ for some $a,b\in\mathbb{R}$ then $g'^{-1}(a,b)$ is open in $B$. Let $x\in g'^{-1}(a,b)$. If $x\neq *$ then there exists an open neighbourhood $U$ of $x$ in $A$ (and thus in $B$) such that $g'(U)=g(U)\subseteq (a,b)$ (by continuity of $g$). Therefore the only thing that we actually have to prove is the existence of a neighbourhood $U$ of $*$ such that $g'(U)\subseteq (a,b)$.
Take $\epsilon := \min\big(|b-c|, |a-c|\big) > 0$. Since $g-c$ vanishes then there exists a compact subset $C\subset A$ such that
$$g(A\backslash C)\subseteq (c-\epsilon, c+\epsilon)\subseteq (a,b)$$
By the definition of the one point compactification $U:=A\backslash C\cup\{*\}$ is open in $B$ and since $g'(*)=c$ then $g'(U)\subseteq (a,b)$ which completest the proof. $\Box$