Munkres Topology section 50 exercise 6(e), continuous function that tends to infinity The main problem is to prove the following theorem.

Let $X$ be a locally compact Hausdorff space with a countable basis, such that every compact subspace of $X$ has topological dimension at most $m$. Then $X$ is homeomorphic to a closed subspace of $\mathbb{R}^{2m+1}$.

Also, we have a definition.

If $f : X \to \mathbb{R}^{N}$ is a continuous map, we say $f(x) \to \infty$ as $x \to \infty$ if given $n$, there is a compact subspace $C$ of $X$ such that $\|f\|(x) > n$ (I think it means that $f(x) \notin$ 'closed $n$-ball centered at the origin') for $x \in X - C $.

And the following is part (e), where I'm stuck.

Show there exists a map $f : X \to \mathbb{R}^{N}$ such that $f(x) \to \infty$ as $x \to \infty$. [Hint: Write $X$ as the union of compact subspaces $C_n$ such that $C_n \subset$ Int $C_{n+1}$ for each $n$.]

First, I do know that locally compact second-countable space is $\sigma$-compact, so I know that there are compact subspaces $C_n$ that $C_n \subset C_{n+1}$. But how can I assure that $C_n \subset$ Int $C_{n+1}$?
Second, how can I proceed if I succeed in constructing $C_n$s that satisfy the conditions(that is, how can I make the desired function $f$)?
Edited: The 'first' part is understood. I still have the second part; suppose I have a function $f_n$ defined on $C_n$ that has value $n$ on the boundary of $C_n$. How can I extend it to $f_{n+1}$ defined on $C_{n+1}$ that equals $f_n$ on $C_n$ and has value $n+1$ on the boundary of $C_{n+1}$ so that I can eventually get a function $f$ that $f(x) \to \infty$ as $x \to \infty$?
 A: Def: A space $X$ is locally compact if each of its points has a neighbourhood base consisting of compact sets. A space $X$ is $\sigma$-compact if it can be written as union of countably many compact subsets.

Let $X$ be $\sigma$-compact and locally compact. Then $X$ can be written $X=\bigcup_\mathbb{N}U_n$, where each $U_n$ is open with $\overline U_n$ compact and satisfies $\overline U_n\subseteq U_{n+1}$.

Proof: Use $\sigma$-compactness to write $X=\bigcup_\mathbb{N}K_n$ with each $K_n$ compact. Each point of $K_1$ has a compact neighbourhood, and since $K_1$ is compact it can be covered by the interiors of finitely many such sets. Let $U_1$ be the union of these interiors so that $K_1\subset U_1$ and $\overline U_1$ is compact. Now take the compact set $\overline U_1\cup K_2$ and repeat to find a relatively compact open set $U_2$ with $\overline U_1\cup K_2\subseteq U_2$. Inductively we have a sequence of relatively compact open sets $U_1\subseteq U_2\subseteq\dots$ with $\overline U_n\subseteq U_{n+1}$ for each $n\in\mathbb{N}$. Since $K_n\subseteq U_{n+1}$ for each $n\in\mathbb{N}$ we have $X=\bigcup_\mathbb{N}K_n\subseteq\bigcup_\mathbb{N}U_n$. Thus this gives the desired exhaustion. $\square$
Of course we have a compact exhaustion of $X$ obtained by writing $X=\bigcup_\mathbb{N}\overline U_n$, but the result above is a little sharper. Notice that we haven't used any separation axioms.
To make the link with the question notice that if $X$ is locally compact and second-countable, then it is $\sigma$-compact, since any given open cover is refined by a countable cover consisting of relatively compact open sets.
We next construct an exhaustion function. Write $X=\bigcup_\mathbb{N}K_n$ with each $K_n$ compact and with $K_n\subseteq int(K_{n+1})$. We need at this stage to add the assumption that  $X$ is Hausdorff. We work inductively, beginning with the map $f_1:K_1\rightarrow \mathbb{R}$ which is constant at $1$.
Suppose we have constructed a continuous $f_n:K_n\rightarrow \mathbb{R}$ which takes the value $n$ at some point of $\partial K_n$. Since both $K_n$ and $\partial K_{n+1}=K_{n+1}\setminus int(K_{n+1})$ are closed in $K_{n+1}$, so is their union $K_n\cup \partial K_{n+1}$, and since $K_n\subseteq int(K_{n+1})$, the sets $K_n$ and $\partial K_{n+1}$ are disjoint. Thus the function $K_n\cup \partial K_{n+1}\rightarrow\mathbb{R}$ which is $f_n$ on $K_n$ and constant at $n+1$ on $\partial K_{n+1}$ is continuous. Since $K_{n+1}$ is compact Hausdorff it is normal, and hence this map has a continuous extension to a map $f_{n+1}:K_{n+1}\rightarrow \mathbb{R}$. By construction this map takes the value $n+1$ on the boundary $\partial K_{n+1}$. If we like we can replace $f_{n+1}$ by the function $\max\{f_{n+1},n+1\}$ to ensure that its maximum is achieved on the boundary, but this is not really necessary.
In this way we obtain a function $f:X=\bigcup_\mathbb{N}K_n\rightarrow\mathbb{R}$ by requiring that $f|_{K_n}f_n$. Then $f$ is well-defined because each $f_{n+k}$ extends $f_n$, and $f$ is continuous since each point of $X$ has an open neighbourhood on which it is continuous (namely some $int(K_n)$).
These seemed to be the questions you were asking about specifically. Here is another approach to the problem.
Let $X$ be locally compact Hausdorff. Then $X$ is regular Hausdorf (in fact Tychonoff). Thus if $X$ is second-countable, then it is metrisable (this is the Urysohn metrisation theorem), and in particular paracompact. Choose a countable covering $\{U_n\}_\mathbb{N}$ of $X$ by relatively compact open sets and let $\{\xi_n:X\rightarrow I\}_\mathbb{N}$ be a locally-finite partition of unity precisely subordinate to this covering. Define $f:X\rightarrow \mathbb{R}$ by
$$f(x)=\sum_\mathbb{N}n\cdot\xi_n(x).$$
Then $f$ is continuous and positive, and moreover for each $k\in\mathbb{N}$ the preimage $f^{-1}(-\infty,k]$ is compact (notice that it is contained in the compact $\bigcup^k_{i=1}\overline U_i$). If $X$ is non-compact, then $f$ is unbounded.
