Clarification of Hopcroft's proof that "deciding whether a program halts on all inputs" is not R.E
$M'$ doesn't "need" to do anything.  $M'$ is a machine that we construct for purposes of the proof.  Hopcroft wrote the theorem, so he can design $M'$ however he wanted -- of course, then it's his obligation to show how his choice of machine helps him prove the theorem.  He chose $M'$ cleverly in a way that helps make the proof easy, but that was his choice.

So, it was his choice to make the $M'$ simulate $M$ for only $n$ steps.  He could have chosen something else, but this particular choice makes the proof work out nicely.  In particular, this property of $M'$ is useful for showing that statement 4 is true.  (Exercise: try proving that statement 4 is true, and check where you used the fact that $M'$ will only simulate $M$ for $n$ steps, not more.)