In a ring with no zero-divisors, for $(m,n) =1$, $a^m = b^m$ and $a^n = b^n$ $\iff a =b$ [duplicate]
Use induction on $m+n$. For $m+n=2$ the statement is obvious. Now suppose that you already proved the statement for all cases lower than $m+n$ then for this case by your method we have $a^n=b^n$ and $a^{m-n}=b^{m-n}$, hence by induction hypothesis we have $a=b$.
Note. Because of this fact that $(m,n)=1$ it follows that we always get relatively prime natural exponents.
Let $d$ be the smallest positive integer such that $a^d = b^d$ where $a \ne 0, b \ne 0.$ By dividing $m$ by $d,$ we can express $m$ as $qd+r$, where $0 \leqslant r < d$ and $q,r \in \mathbb{Z}.$ So $a^{qd+r} = b^{qd+r},$ and therefore $(a^d)^qa^r = (b^d)^qb^r \Longrightarrow x^q(a^r-b^r) = 0.$ Since $a^d = b^d = x,$ and $x^{q} \ne 0$ it follows that $(a^r - b^r) = 0$ (since $R$ is a ring with no zero divisors) $\Longrightarrow a^r = b^r.$ This forces $r = 0$ since $0 \leqslant r < d$ and $d$ is minimal. Thus $m = qd$ so that $d \mid m.$ Similarly, $d \mid n.$ Thus $d \mid \gcd(m,n) = 1 \Longleftrightarrow d \mid 1 \Longleftrightarrow a = b. \Box$
Notice that your idea doesn't (directly) show any signs that it will be needing the "coprime" condition. Perhaps we should follow that first.
If $m,n$ are coprime, there exist $i,j$ such that $mi+nj=1$.
Then $a^1=a^{mi+nj}=$?
Addendum: As drhab and lhf have pointed out in the comments, I have let my intuition run away with me on the likely answer, and there is still a final twist possible in the end, since we can't count on $a$ being invertible, and so having sensible negative exponents defined.
In your combination relating $1$ with $m$ and $n$, you must rearrange so that no negative integers appear. Say, if $i$ is negative, write $1+m(-i)=nj$, and if $j$ is negative, $1+n(-j)=mi$.
In the first case, for example, you can write $a(a^m)^{-i}=a^{1+m(-i)}=(a^n)^j=(b^n)^j=b^{1+m(-i)}=b((b^m)^{-i})=b(a^m)^{-i}$.
By cancelling $(a^m)^{-i}$ from both sides, you have $a=b$.
The other case is analogous.
Hint $\ $ The set of $\,k\in \Bbb N\,$ such that $\,a^k = b^k\,$ is closed under subtraction $\,> 0\,$ therefore its least element $\,d\,$ divides every element, so $\,d\mid m,n\,\Rightarrow\,d\mid (m,n)=1,\,$ so $\,d =1.\ \ $ QED
Remark $\ $ More conceptually in $\,S = R[b^{-1}]= R[x]/(bx\!-\!1)\,$ the order $\,d\,$ of $\, a/b\,$ divides the coprimes $\,m,n\,$ so $\,d=1,\,$ so $\,a/b = 1,\,$ so $\,a=b\,$ in $\,S,\,$ so also in $\,R,\,$ by $R$ embeds in $\,S\,$ (see here for a very simple little-known proof)