You've made a small error in computing $\phi(p^n)$. $\phi(p^n) = p^n - p^{n-1}$, not $p^n - 1$. If $k$ is relatively prime to $p^n$, $k$ must be relatively prime to $p$. Thus, to count $\phi(p^n)$, we need to count multiples of $p$ less than or equal to $p^n$. These are $p, 2p, 3p,\dots, (p^{n-1} - 1)p, p^{n-1} p$. There are precisely $p^{n-1}$ such numbers, so $\phi(p^n) = p^n - p^{n-1}$. So the sum you want to compute is actually
$$
\sum_{d\mid p^n, \, d > 0}\phi(d) = \phi(1) + \phi(p) + \dots + \phi(p^n) = 1 + (p - 1) + (p^2 - p) + \dots + (p^n - p^{n-1}).
$$
Can you finish it from here?