If every nonidentity element in a group is of order $2$, the group is abelian
Alternative proof : $a^2=1$ so every element is its one inverse.
So, $(ab)^{-1}=ab$, but $(ab)^{-1}=b^{-1}a^{-1}=ba$ by using twice again the remark.
Your proof is correct.
You can improve it by making the derivations clearer (as you have done in the comments).