I will give a proof not based on properties of matrix reduction (such as that every matrix has a unique row reduced echelon form) as I consider these rather hard to prove formally. I will however assume known that every family of linearly independent vectors can be extended to a basis of the whole space. Also given any basis $[b_1,\ldots,b_n]$ of $F^n$ (where $F$ is the field of scalars one is working with), and any family $[w_1,\ldots,w_n]$ of vectors, there is a linear map that sends each $b_i$ to $w_i$, namely the one sending an arbitrary vector written as $\lambda_1b_1+\cdots+\lambda_nb_n$ to $\lambda_1w_1+\cdots+\lambda_nw_n$.
Take a basis $[v_1,\ldots,v_k]$ of $\def\null{\operatorname{null}}\null(A)$ and extend it to a basis $[v_1,\ldots,v_n]$ of $F^n$. Then the vectors $Av_{k+1},\ldots,Av_n$ are linearly independent, since a relation $0=\lambda_{k+1}Av_{k+1}+\cdots+\lambda_nAv_n$ implies via $A(\lambda_{k+1}v_{k+1}+\cdots+\lambda_nv_n)=0$ that $\lambda_{k+1}v_{k+1}+\cdots+\lambda_nv_n\in\null(A)=\operatorname{span}(v_1,\ldots,v_k)$, which forces $\lambda_{k+1}=\cdots=\lambda_n=0$ since $[v_1,\ldots,v_n]$ is a basis. Similarly $Bv_{k+1},\ldots,Bv_n$ are linearly independent, since $\null(B)=\null(A)$. Now extend each of these linearly independent families to a basis of $F^n$, calling them respectively $\def\B{\mathcal B}\B_A$ and $\B_B$. Now let $f:F^n\to F^n$ be a linear map sending each vector of the basis $\B_B$ to the corresponding vector of the basis $\B_A$, and let $U$ be the matrix of$~f$ (with respect to the standard basis). We have in particular $(UB)v_i=U(Bv_i)=f(Bv_i)=Av_i$ for $i=k+1,\ldots,n$. But one also has $(UB)v_i=U(Bv_i)=Av_i$ for $i=1,\ldots,k$ since both side are zero. Then matrices $UB$ and $A$, giving the same results when applied to all vectors of the basis $[v_1,\ldots,v_n]$, must be equal matrices.
It remains to show that the matrix $U$ is invertible; this is so because the map $f$ is, its inverse being the linear map that sends each vector of the basis $\B_A$ to the corresponding vector of the basis $\B_B$.
The opposite implication is clear, since $UBx=0\iff Bx=U^{-1}UBx=0$.