The textbook that I have been using to learn group theory asked, as an exercise, to prove the following:
The proof is straightforward. However, what has me confused is the following remark that the author makes after the exercise has been completed:
My understanding of an endomorphism is a homomorphic mapping of a group to itself (i.e. $f: G \rightarrow G)$. In the case of what we were asked to prove, the mappings were between different groups; consequently, I am unsure of why this proof motivated (or served as a convenient segue for) these remarks. I fail to see the relationship between what I proved and the subsequent commentary.
Any explanation would be appreciated!


If we let $G=H=M$, we've shown in the proposition that the composition of two endomorphisms $f,g:G\to G$ is an endomorphism, so since we have an identity endomorphism (and the composition of functions is associative), we have a monoid. If the endomorphisms are automorphisms then we have inverses, which then gives us the group $\text{Aut}(G)$.