Let $G$ be a free group and $a,b\in G$ be such that $a^n=b^n$ for some $n\in\mathbb{Z}$. Then $a=b$.
I followed following way: if rank(G) is 1, then $G$ will be cyclic, and assertion is true.
Since $\langle a,b\rangle$ is subgroup of a free group, it should be free and we can assume that its rank is 2.
Since $a^n=b^n$, we have $$b^{-1}a^nb=a^n.$$ In $a^n=a.a.\cdots.a$ there is no cancellation. We must have that $b\neq a^{-1}$ (otherwise $b^n=a^n=b^{-n}$ i.e. $b^{2n}=1$, contradiction.) Hence last two terms in LHS do not cancel.
If $a\neq b$ then first two terms on LHS will also not cancel. Hence word on LHS is reduced and with length equal to $n+2$, whereas reduced word on RHS has length $n$, a contradiction. So we must have $a=b$.
Is this argument correct? Please suggest if there are different ways to prove this.
The following may also be a way: $\langle a,b\rangle$ is a subgroup of a free group, it is free. It it is of rank $1$, then there exists $c$ such that $a=c^i$ and $b=c^j$. Then $a^n=b^n$ implies $c^{in}=c^{jn}$ where $\langle c\rangle$ is infinite cyclic. We must have $in=jn$ i.e. $i=j$, hence $a=b$.
If rank of $\langle a,b\rangle$ is $2$ then $a^n=b^n$ should imply $a=b$ otherwise $\langle a,b\rangle$ will not be free. Is this correct?
I would go like this:
The equation $a^n = b^n$ (for some $a,b \neq 1$, otherwise the assertion holds since free groups are torsion free and $n \neq 0$ otherwise it is simply not true and $n \neq \pm 1$ since it is then trivially true) implies (as you already wrote) $$b^{-1} a^n b = b^{-1} b^n b = b^n = a^n.$$ But this is nothing else than $$[b, a^{-n}] = 1.$$ Thus $b$ and $a^{-n}$ are two commuting non-trivial elements in a free group, thus $b, a^{-n} \in \langle c \rangle$ for some non-trivial $c \in G$. In particular $b, a^n \in \langle c \rangle$. Thus looking at the Cayley graph of $G$ and setting $m$ to be minimal such that $a^m \in \langle c \rangle$ (and $m \neq 0$), we see that the "line" $\langle c \rangle$ and the "line" $\langle a \rangle$ cross at $a^m$. But this would give us a circuit (which is forbidden since $G$ "is" a tree) unless $k = 1$, i.e. $a \in \langle c \rangle$. Thus $a = c^k$ and $b = c^l$, i.e. $a^n = b^n$ implies $kn = ln$ hence $k=l$ ($n \neq 0$).