I think this is probably not appropriate. You could ask the professor, but if it were me I would say no.
An important part of learning math at the undergraduate level is being able to write math clearly, and this includes the low-level yet essential skill of being able to handwrite or typeset math notation. If you're typesetting the assignments for your friend, the professor is not getting an accurate view of their proficiency at this skill, which could factor into the grade.
There could be an exception if your friend has a disability that makes it unusually difficult for him to write clearly by hand. But again, you would need the consent of the professor (and possibly also of some university disability service office).
(If your friend doesn't have a disability but just has particularly atrocious handwriting, the professor might agree to this, simply out of self-preservation; reading bad handwriting can be really frustrating.)
I agree with Massimo Ortolano that in the long run, the best thing would be to help your friend learn to typeset the assignments himself. You could of course typeset some of his previous assignments for him as an example.