If $A$ is a square matrix which coefficients are the scalar of a field $\Bbb K$ then there exist a linear function $f:\Bbb K^n\rightarrow\Bbb K^n$ such that $$ f(e_j):=A_j $$ where $A_j$ is the $j$-th column of $A$ for any $j=1,...,n$.
Then if $I$ is the identity square matrix if $A$ and $B$ are two square matix such that $AB=I$ then there exist two function $f,g:\Bbb K^n\rightarrow\Bbb K^n$ such that the identity square matrix is the matrix of the function $(f\circ g)$ and this means that $(f\circ g)$ is the identity on $\Bbb K^n$. So to prove the statement of the question I have to prove that $(g\circ f)$ is the identity too. So how prove the statement? Could someone help me, please?
$f\circ g = \text{id}$ implies $g$ is injective (if a composition is injective then the "inner" function is always injective). Since $g:\Bbb{K}^n\to \Bbb{K}^n$ is a map between vector spaces of the same dimension, the rank-nullity theorem implies $g$ is also bijective. Thus, $f = g^{-1}$.
Another way to phrase the argument is to say that since $f\circ g = \text{id}$, then $f$ is surjective (again if a composition is surjective, then the "outer" function is surjective). Again, rank-nullity implies $f$ is bijective, so that again $g=f^{-1}$.