If GCD $(a_1,\ldots, a_n)=1$ then there's a matrix in $SL_n(\mathbb{Z})$ with first row $(a_1,\ldots, a_n)$
Suppose the statement holds for $n\geq2$, and consider integers $a_1,\ldots,a_{n+1}$ whose GCD is $1$. Let $d=\gcd(a_1,a_2,\ldots,a_n)$, and let $a_i'=a_i/d$ for $i\leq n$. Note that $$ 1=\gcd(a_1,\ldots,a_{n+1})=\gcd(d, a_{n+1}) $$ and $$ 1=\gcd(a_1',\ldots,a_n'). $$ By induction, there are matrices $X\in SL_2(\mathbb Z)$ and $Y\in SL_n(\mathbb Z)$ whose first rows are $(d, a_{n+1})$ and $(a_1',\ldots,a_n')$ respectively. Let $$ X=\begin{pmatrix}d&a_{n+1}\\ p&q\end{pmatrix}. $$ Also consider the $1\times n$ row matrix $v=\begin{pmatrix}p&0&\ldots&0\end{pmatrix}$ and the $n\times 1$ column matrix $w=\begin{pmatrix}a_{n+1}&0&\ldots&0\end{pmatrix}^T$. Let $D$ be the $n\times n$ diagonal matrix with diagonal $(d,1,\ldots,1)$. Let $$ Z=\begin{pmatrix}DY&w\\ vY&q\end{pmatrix}. $$ Note that the first row of $Z$ is $(a_1,\ldots,a_{n+1})$. Also $$\begin{eqnarray*} Z\begin{pmatrix}Y^{-1}&0\\ 0&1\end{pmatrix} &=&\begin{pmatrix}D&w\\ v&q\end{pmatrix}\\ &=&\begin{pmatrix}d&0&a_{n+1}\\0&I&0\\ p&0&q\end{pmatrix}. \end{eqnarray*}$$ Since $X$ is invertible over $\mathbb Z$, so is the RHS, and so is $Z$. Thus $\det(Z)=\pm1$, and we get the required matrix by flipping the sign of one row of $Z$ if necessary.