Here's the question:
Let $K\subseteq \mathbb{R}$ and suppose that there exists a sequence $(k_n)$ in $K$ that converges to a number $k_0 \not\in K$. Show that there is an unbounded continuous function on $K$.
Here's the function I choose: $f\colon K \to \mathbb{R}$ given by $f(x)=\frac{1}{k_0 - x}$. Clearly, f is continuous and it remains to show $f$ is unbounded. Suppose that $f$ is bounded i.e. $|f(x)|< M$ for all $x \in K$ (also for some $M>0$). This means that that $|f(k_n)| < M $ for all $n \in \mathbb{N}$. Hence, $\lim |f(k_n)| \le M$ but then this is a contradiction since $\lim |f(k_n)| = +\infty$.
Is this proof okay? And I've chosen my codomain to be the $\mathbb{R}$ and is that fine?
Yes, it is correct. But you don't need to do it by contradiction. Given $M\in\mathbb{R}^+$, there is some $n\in\mathbb N$ such that $|k_0-k_n|<\frac1M$. And this means that $\bigl|f(k_n)\bigr|>M$. Since this occurs for every $M\in\mathbb{R}^+$, $f$ is unbounded.