Isomorphism on Set of Homomorphisms Question (Rotman Advanced Algebra)

Hi, hope you can help me with a question that has been annoying me.

It's from Rotman Advanced Modern Algebra, Ex. 7.5.

For every R-module M, prove that there is an R-isomorphism

given by

I have got everything apart from the part of the proof that is surjective.

I've been turning it over and I think I'm just missing something. Any ideas? Any help is much appreciated. I'm new here, am starting postgrad maths soon and look forward to getting to know you guys.