Let $G$ be a group, and let $n\in\mathbb Z$. Show that $(ab)^n=a^nb^n\iff(ab)^{1-n}=a^{1-n}b^{1-n}$.
Assuming that the book has a typo, we prove $(ab)^n=a^nb^n$ if and only if $(ba)^{1-n}=b^{1-n}a^{1-n}$. Left and right multiply $(ab)^n$ by $a^{-1}$ and $b^{-1}$ respectively and we get $(ba)^{n-1}$. This follows since $$(ab)^n=abab\ldots ab$$ for $n$ positive, and by taking inverses for $n$ negative. Thus we have $$(ba)^{n-1}=a^{n-1}b^{n-1}.$$ Take inverses to get one implication. Can you do the other yourself?
Also, to show that the statement to be proved (as given in the source) is false, consider the following example . . .
In $S_5$, using cycle notation, let $a = (1\;2\;3\;4\;5)$, and let $b = (2\;4\;5\;3)$.
Then by direct calculation, it can be verified that $$(ab)^3 = a^3b^3$$ $$(ab)^2 \ne b^2a^2$$ hence $$(ab)^{-2}\ne a^{-2}b^{-2}$$