Let us give a more general result:
Result: Let $T:V\rightarrow V$ be a linear operator on a finite dimensional vector space $V$ such that there is another linear operator $U$ on $V$ satisfying $TU=I$. Then show that, $UT=I$.
Proof: Since $TU=I$, so $T$ is onto. Now $V$ is finite dimensional, so from Rank-Nullity theorem $Nullity(T)=0$$\operatorname{Nullity}(T)=0$, which implies $Ker(T)=\{0\}$$\operatorname{Ker}(T)=\{0\}$.
Now for any $v\in V$ we have, $T(UT-I)v=(TU-I)Tv=0$. So $(UT-I)v\in Ker(T)$$(UT-I)v\in \operatorname{Ker}(T)$ for all $v\in V$, which gives $(UT-I)v=0$ for all $v\in V$. Thus, $UT-I=0$.
[Note: Finiteness of $dim(V)$$\operatorname{dim}(V)$ is necessary. Otherwise, "$T$ is onto $\Rightarrow Ker(T)=\{0\}$$\Rightarrow \operatorname{Ker}(T)=\{0\}$" does not hold in an infinite dimensional vector space.]
Now a square matrix $A$ of size $n$ over a field $F$ can be treated as a linear operator on $F^n$ by following linear map $L_A: F^n\rightarrow F^n$, defined by $L_A(v)=Av$ for all column vector $v\in F^n$.
For two $n\times n$ matrix $A$, $B$, we clearly have $L_AL_B=L_{AB}$. Now put $T=L_A$ and $U=L_A$ then the required result follows.