i think you should change the title of your post to "|End(G)|=|G|", because right now it has nothing to do with your post! anyway, this is a good question, especially for those who would like to

see non-trivial applications of fundamental theorem of finite abelian groups. to solve the problem,i'll assume thatis not cyclicand i'll show that :

we have where and let for any

define by: it's easy to see that and if and only if

therefore: the only thing left to prove is that: so we define by: note that

is well-defined because it's clear that now suppose that for some then for some which is obviously nonsense!