Edit : the free group consists of all reduced words that can be built from members of and formal inverses of members of . Prove:
If $a^n=b^n$ with $n>1$ in a free group, then $a=b.$
My solution :
(a) $a^n=b^n$; both sides are multiplied (left side) by $a^{-n}$, then $a^{-n}a^n = 1 = a^{-n}b^n = (a^{-1}b)^n$
$a^{-1}b=1 \implies a=b$ since we know that non identity element is of non finite order.
I'd be grateful for your feedback!
Usually one defines a free group on $S$ as the set of reduced words (not just "words") on the elements of $S$ (and perhaps also "and their formal inverses", depending on exactly how you define "word").
The claim that $a^{-n}b^n = (a^{-1}b)^n$ is not just wrong, it is very wrong. For $n\notin\{0,1\}$. that assertion requires normally requires $a^{-1}$ and $b$ to commute. In a free group, this will not generally happen. For example, if $S=\{x,y\}$, does $(x^{-1}y)^2$ equal $x^{-2}y^2$? No. The first one is $x^{-1}yx^{-1}y$, the second one is $x^{-1}x^{-1}yy$; these are different reduced words, and therefore are distinct elements of the free group on $S$.
So your approach is doomed.
Since your definition of free group is as sets of reduced words, you will probably want to express $a$ and $b$ as reduced words. I recommend expressing them in the form $w_1w_2w_1^{-1}$, where $w_1$ is an arbitrary reduced word, and $w_2$ is a cyclically reduced word (one in which the first letter is not the inverse of the last letter). (You'll have to prove you can always do that if you don't yet know it). Then $a^n = (w_1w_2w_1^{-1})^n = w_1(w_2)^n w_1^{-1}$. Do the same with $b$, and go from there using their expressions as reduced words and using that two reduced words are equal if and only if they are identical.