One approach is to prove that if $X$ is a compact metric space then $X$ is totally bounded. This means that for every $\varepsilon > 0$ there is a finite number, say $n(\varepsilon)$, of points, call them $x_1,\dots,x_{n(\varepsilon)}$, such that the balls $B_\varepsilon(x_1),\dots,B_\varepsilon(x_{n(\varepsilon)})$ cover $X$. This is actually quite simple to prove, because if $X$ is a compact metric space, then given $\varepsilon > 0$, the cover $\{ B_{\varepsilon}(x) : x \in X \}$ has a finite subcover of the desired form.
From there, cover $X$ with finitely many balls of radius $1$; extract the center of each. Now every point is within $1$ of a point in your (finite) set. Cover $X$ with finitely many balls of radius $1/2$; extract the center from each. Now every point is within $1/2$ of a point in your (still finite) set. Repeat for each $1/m$ for $m \in \mathbb{N}$ and take the countable union. A countable union of finite sets is countable, so you have your countable dense subset.
The idea is correct, but not well argumented, I think. It's mostly a problem of notation, however, plus a weakness I'll underline later on.
I'd follow the hint, that is, proving first the space has a countable basis.
For all integers $n>0$, the open cover $\{N_{1/n}(p):p\in K\}$ has a finite subcover; let $X_n=\{x_{n,1}, x_{n,2}, \dots, x_{n,m(n)}\}$ be such that
$$
K=\bigcup_{i=1}^{m(n)}N_{1/n}(x_{n,i})
$$
I claim that the set
$$
\mathcal{B}=\bigcup_{n>0}\bigl\{N_{1/n}(x_{n,i}):1\le i\le m(n)\bigr\}
$$
is a countable basis for $K$. Countability is obvious. Let $p\in K$ and $\varepsilon>0$; we want to prove that there exist $n>0$ and $i$ with $1\le i\le m(n)$ such that $N_{1/n}(x_{n,i})\subseteq N_\varepsilon(p)$.
Take $n$ such that $1/n<\varepsilon/2$. Then $p\in N_{1/n}(x_{n,i})$, for some $1\le i\le m(n)$. If $q\in N_{1/n}(x_{n,i})$, then
$$
d(p,q)\le d(p,x_{n,i})+d(x_{n,i},q)<\frac{1}{n}+\frac{1}{n}<\varepsilon
$$
so $N_{1/n}(x_{n,i})\subseteq N_\varepsilon(p)$ (this is a point where your proof is weak).
Now every metric space having a countable basis is separable. It suffices to take a point in each (nonempty) member of the basis and this is a dense subset, because each open set is the union of members of the basis, so it intersects this countable subset.
Best Answer
For each $n \in \mathbb{Z}_{> 0}$, we take balls $B^n_1, \ldots, B^n_{n_m}$ of radius $1/n$ with centers $x^n_1, \ldots, x^n_{m_n}$ as you have described. Call the collection of centers $\mathcal{C}_n = \{x^n_1, \ldots, x^n_{m_n}\}$. Then $\mathcal{C} = \bigcup_{n \geq 1} \mathcal{C}_n$ is a countable union of finite sets, hence is itself countable. We claim this is a countable dense subset. To show this, your proof should start with: "Given $\epsilon > 0$, choose $n$ such that $1/n < \epsilon$, and consider the centers of the balls $x^n_1, \ldots, x^n_{m_n} \in \mathcal{C}_n$." Do you see how this implies that $\mathcal{C}$ is dense? Note that we defined $\mathcal{C}$ before we ever mentioned $\epsilon$.