Let $M$ be a matrix with rank of $M$ is $n-1$. Then by applying elementary row operation we can make a row in $M$ to be zero. Without loss of any generality, let us assume the last row will be zero by applying elementary row operations. Now note that the rank of $\widehat{M}$ obtained by removing the last row of $M$. That is,

$$M = \begin{bmatrix}\widehat M \\ \hline \text{Last Row} \end{bmatrix}$$

Now it is easy to note that $rank(\widehat M) = n-1$, as rank of $M$ is $n$ and we can write the last row of $M$ as a linear combination of other rows, that is, rows of $\widehat M$. Without loss, let us also assume

$$ rref(\widehat M) = \begin{bmatrix}I_{n-1} & * \end{bmatrix} \qquad rref(M) = \begin{bmatrix}I_{n-1} & * \\\hline \mathbf{0}^t & 0 \end{bmatrix} $$

Let $P$ be a product of elementary matrices such that

$$PM = \begin{bmatrix}\widehat M \\ \hline \mathbf{0}^t \end{bmatrix}$$

Now note that if we change the $(n,n)$th entry in $PM$ from $0$ to $1$ and multiply $P^{-1}$ from right side, that is, revering the elementary row operations, we will get our matrix $M$ on which only single entry is changed.