Is it okay to typeset someone’s to-be-graded assignment for them?
I think that the best favour you can do to your friend is to teach him how to use LaTeX, so that he can improve the look of his work by himself.

In this way, you won't go against any rule and you'll teach your friend a new skill.