$\mathcal Z$-transform of an equation [Exam question]: Verifying the solution
Your mistake is quite simple, originating from a subtle inaccuracy in the reformulation from here
$$
f(k)=-\frac{1}{N}k\sigma(k) + \frac{1}{N}k\sigma(k-N) + \sigma(k) - \sigma(k-N)
$$
to here:
$$
f(k)=-\frac{1}{N}k\sigma(k) + \frac{1}{N}(k-N)\sigma(k-N) + N\sigma(k-N) + \sigma(k) - \sigma(k-N).
$$

The 3rd term of the second equation is only $\sigma(k-N)$ because the $N$ is cancelled by the $1/N$ from the original term. Then, the (corrected) third term cancels with the last one. And then, transforming this to Z-domain gives exactly the result your professor has provided.