[proofplan]
We use the exponential sheaf sequence to identify holomorphic line bundles with a cohomology group controlled by integral cohomology. Cartan's Theorem B kills the higher cohomology of the structure sheaf on the Stein manifold $X$, so the connecting homomorphism from $H^1(X,\mathcal{O}_X^*)$ to $H^2(X,\underline{\mathbb{Z}})$ is an isomorphism. Since the latter group is zero by hypothesis, every class in $H^1(X,\mathcal{O}_X^*)$ is zero, and the cocycle of any holomorphic line bundle is therefore a coboundary. This coboundary gives explicit local nowhere-vanishing holomorphic functions that glue the bundle to $X \times \mathbb{C}$.
[/proofplan]
[step:Apply the exponential sequence on the Stein manifold]
Let $\mathcal{O}_X$ denote the sheaf of holomorphic functions on $X$, let $\mathcal{O}_X^*$ denote the sheaf of nowhere-vanishing holomorphic functions on $X$, and let $\underline{\mathbb{Z}}$ denote the constant sheaf on $X$ with value $\mathbb{Z}$. Consider the exponential sequence of sheaves of abelian groups on $X$:
\begin{align*}
0 \longrightarrow \underline{\mathbb{Z}}
\overset{\iota}{\longrightarrow}
\mathcal{O}_X
\overset{\exp(2\pi i\,\cdot)}{\longrightarrow}
\mathcal{O}_X^*
\longrightarrow 1.
\end{align*}
Here $\iota$ sends a locally constant integer-valued function to the same function regarded as holomorphic, and the exponential map sends a holomorphic function $f$ to the nowhere-vanishing holomorphic function $e^{2\pi i f}$.
Exactness holds because a holomorphic function $f$ satisfies $e^{2\pi i f}=1$ precisely when $f$ is locally constant with values in $\mathbb{Z}$, and because every nowhere-vanishing holomorphic function has a local holomorphic logarithm. Taking sheaf cohomology gives the long exact sequence
\begin{align*}
H^1(X,\mathcal{O}_X)
\longrightarrow
H^1(X,\mathcal{O}_X^*)
\overset{\delta}{\longrightarrow}
H^2(X,\underline{\mathbb{Z}})
\longrightarrow
H^2(X,\mathcal{O}_X),
\end{align*}
where $\delta$ is the connecting homomorphism.
[guided]
The bridge between holomorphic line bundles and topology is the exponential sequence. We write the relevant sheaves explicitly: $\mathcal{O}_X$ is the sheaf assigning to each open set $U \subseteq X$ the ring $\mathcal{O}_X(U)$ of holomorphic maps $U \to \mathbb{C}$, $\mathcal{O}_X^*$ is the sheaf assigning to $U$ the group of holomorphic maps $U \to \mathbb{C}^*$, and $\underline{\mathbb{Z}}$ is the constant sheaf with stalk $\mathbb{Z}$.
The sheaf morphism
\begin{align*}
\mathcal{O}_X &\longrightarrow \mathcal{O}_X^* \\ f &\longmapsto e^{2\pi i f}
\end{align*}
has kernel exactly $\underline{\mathbb{Z}}$. Indeed, if $e^{2\pi i f}=1$ on a connected open set, then $f$ takes values in the discrete set $\mathbb{Z}$, hence $f$ is constant there by continuity. Conversely, every integer-valued locally constant function maps to $1$. The map is locally surjective because every nowhere-vanishing holomorphic function has a local holomorphic logarithm. Therefore we have an exact sequence of sheaves:
\begin{align*}
0 \longrightarrow \underline{\mathbb{Z}} \overset{\iota}{\longrightarrow} \mathcal{O}_X \overset{\exp(2\pi i\,\cdot)}{\longrightarrow} \mathcal{O}_X^* \longrightarrow 1.
\end{align*}
Applying sheaf cohomology to this short exact sequence gives a long exact sequence. The segment we need is
\begin{align*}
H^1(X,\mathcal{O}_X) \longrightarrow H^1(X,\mathcal{O}_X^*) \overset{\delta}{\longrightarrow} H^2(X,\underline{\mathbb{Z}}) \longrightarrow H^2(X,\mathcal{O}_X).
\end{align*}
The point of introducing this sequence is that $H^1(X,\mathcal{O}_X^*)$ classifies holomorphic line bundles, while $H^2(X,\underline{\mathbb{Z}})$ is the topological obstruction group appearing in the hypothesis.
[/guided]
[/step]
[step:Use Cartan's Theorem B to identify $H^1(X,\mathcal{O}_X^*)$ with $H^2(X,\underline{\mathbb{Z}})$]
Since $X$ is Stein and $\mathcal{O}_X$ is a coherent analytic sheaf, Cartan's Theorem B gives
\begin{align*}
H^q(X,\mathcal{O}_X)=0
\end{align*}
for every integer $q \geq 1$. In particular,
\begin{align*}
H^1(X,\mathcal{O}_X)=0
\qquad\text{and}\qquad
H^2(X,\mathcal{O}_X)=0.
\end{align*}
Substituting these vanishings into the long exact sequence from the exponential sequence shows that
\begin{align*}
0
\longrightarrow
H^1(X,\mathcal{O}_X^*)
\overset{\delta}{\longrightarrow}
H^2(X,\underline{\mathbb{Z}})
\longrightarrow
0
\end{align*}
is exact. Hence the connecting homomorphism
\begin{align*}
\delta: H^1(X,\mathcal{O}_X^*) \longrightarrow H^2(X,\underline{\mathbb{Z}})
\end{align*}
is an isomorphism.
[guided]
We now use the Stein hypothesis. Cartan's Theorem B states that if $X$ is a Stein manifold and $\mathcal{F}$ is a coherent analytic sheaf on $X$, then
\begin{align*}
H^q(X,\mathcal{F})=0
\end{align*}
for every integer $q \geq 1$. The sheaf $\mathcal{O}_X$ is coherent as a module over itself, so the theorem applies with $\mathcal{F}=\mathcal{O}_X$. Therefore
\begin{align*}
H^1(X,\mathcal{O}_X)=0 \qquad\text{and}\qquad H^2(X,\mathcal{O}_X)=0.
\end{align*}
Insert these two vanishings into the exact segment
\begin{align*}
H^1(X,\mathcal{O}_X) \longrightarrow H^1(X,\mathcal{O}_X^*) \overset{\delta}{\longrightarrow} H^2(X,\underline{\mathbb{Z}}) \longrightarrow H^2(X,\mathcal{O}_X).
\end{align*}
Exactness then becomes
\begin{align*}
0 \longrightarrow H^1(X,\mathcal{O}_X^*) \overset{\delta}{\longrightarrow} H^2(X,\underline{\mathbb{Z}}) \longrightarrow 0.
\end{align*}
A homomorphism sitting in an exact sequence of this form is both injective and surjective, hence it is an isomorphism:
\begin{align*}
\delta: H^1(X,\mathcal{O}_X^*) \longrightarrow H^2(X,\underline{\mathbb{Z}}).
\end{align*}
This is the key step: Steinness converts the analytic classification group $H^1(X,\mathcal{O}_X^*)$ into the purely topological group $H^2(X,\underline{\mathbb{Z}})$.
[/guided]
[/step]
[step:Deduce that the holomorphic line bundle class is zero]
By hypothesis,
\begin{align*}
H^2(X,\mathbb{Z})=0.
\end{align*}
Interpreting this as sheaf cohomology with coefficients in the constant sheaf $\underline{\mathbb{Z}}$, we have
\begin{align*}
H^2(X,\underline{\mathbb{Z}})=0.
\end{align*}
Since $\delta$ is an isomorphism, it follows that
\begin{align*}
H^1(X,\mathcal{O}_X^*)=0.
\end{align*}
Let
\begin{align*}
\pi: L \longrightarrow X
\end{align*}
be a holomorphic line bundle. Choose an open cover $\mathfrak{U}=\{U_i\}_{i \in I}$ of $X$ by holomorphic trivialising open sets for $L$. For each $i \in I$, choose a holomorphic trivialisation
\begin{align*}
\varphi_i: \pi^{-1}(U_i) \longrightarrow U_i \times \mathbb{C}
\end{align*}
over $U_i$. On each nonempty overlap $U_i \cap U_j$, define
\begin{align*}
g_{ij}: U_i \cap U_j &\longrightarrow \mathbb{C}^*
\end{align*}
by the condition that
\begin{align*}
\varphi_i \circ \varphi_j^{-1}(x,z)=(x,g_{ij}(x)z)
\end{align*}
for every $x \in U_i \cap U_j$ and every $z \in \mathbb{C}$. The family $(g_{ij})$ is a Čech $1$-cocycle with values in $\mathcal{O}_X^*$ and represents the class of $L$ in $H^1(X,\mathcal{O}_X^*)$.
Since $H^1(X,\mathcal{O}_X^*)=0$, this cocycle is a coboundary. Hence there exist holomorphic maps
\begin{align*}
h_i: U_i \longrightarrow \mathbb{C}^*
\end{align*}
such that
\begin{align*}
g_{ij}=h_i h_j^{-1}
\end{align*}
on every nonempty overlap $U_i \cap U_j$.
[guided]
We have proved that
\begin{align*}
H^1(X,\mathcal{O}_X^*) \cong H^2(X,\underline{\mathbb{Z}}).
\end{align*}
The theorem assumes $H^2(X,\mathbb{Z})=0$, which is the same coefficient group expressed as cohomology with the constant sheaf $\underline{\mathbb{Z}}$:
\begin{align*}
H^2(X,\underline{\mathbb{Z}})=0.
\end{align*}
Therefore the isomorphism forces
\begin{align*}
H^1(X,\mathcal{O}_X^*)=0.
\end{align*}
Now take an arbitrary holomorphic line bundle
\begin{align*}
\pi: L \longrightarrow X.
\end{align*}
By definition of a holomorphic line bundle, there is an open cover $\mathfrak{U}=\{U_i\}_{i \in I}$ of $X$ and, for each $i \in I$, a holomorphic bundle trivialisation
\begin{align*}
\varphi_i: \pi^{-1}(U_i) \longrightarrow U_i \times \mathbb{C}.
\end{align*}
On an overlap $U_i \cap U_j$, the transition map between the two trivialisations preserves the base point and is complex-linear on each fiber, so it has the form
\begin{align*}
\varphi_i \circ \varphi_j^{-1}(x,z)=(x,g_{ij}(x)z),
\end{align*}
where
\begin{align*}
g_{ij}: U_i \cap U_j \longrightarrow \mathbb{C}^*
\end{align*}
is holomorphic and nowhere zero. The compatibility of triple transition maps gives the cocycle identity
\begin{align*}
g_{ij}g_{jk}=g_{ik}
\end{align*}
on every nonempty triple overlap $U_i \cap U_j \cap U_k$. Thus $(g_{ij})$ is a Čech $1$-cocycle with coefficients in $\mathcal{O}_X^*$.
The cohomology class of this cocycle is the holomorphic isomorphism class of $L$. Since
\begin{align*}
H^1(X,\mathcal{O}_X^*)=0,
\end{align*}
the cocycle represents the zero class. Therefore there are holomorphic nowhere-vanishing maps
\begin{align*}
h_i: U_i \longrightarrow \mathbb{C}^*
\end{align*}
such that
\begin{align*}
g_{ij}=h_i h_j^{-1}
\end{align*}
on each nonempty overlap $U_i \cap U_j$.
[/guided]
[/step]
[step:Glue the local rescalings to obtain a global holomorphic trivialisation]
For each $i \in I$, define a holomorphic map
\begin{align*}
\psi_i: \pi^{-1}(U_i) &\longrightarrow U_i \times \mathbb{C} \\
v &\longmapsto (x,h_i(x)^{-1}z),
\end{align*}
where $x=\pi(v)$ and $\varphi_i(v)=(x,z)$. On an overlap $U_i \cap U_j$, if $\varphi_j(v)=(x,z_j)$ and $\varphi_i(v)=(x,z_i)$, then $z_i=g_{ij}(x)z_j$. Hence
\begin{align*}
h_i(x)^{-1}z_i
=
h_i(x)^{-1}g_{ij}(x)z_j
=
h_i(x)^{-1}h_i(x)h_j(x)^{-1}z_j
=
h_j(x)^{-1}z_j.
\end{align*}
Therefore the maps $\psi_i$ agree on overlaps and glue to a holomorphic bundle map
\begin{align*}
\psi: L \longrightarrow X \times \mathbb{C}.
\end{align*}
For each $x \in X$, the induced map on the fiber $L_x \to \{x\}\times \mathbb{C}$ is multiplication by the nonzero scalar $h_i(x)^{-1}$ in a local trivialisation, so it is a complex-linear isomorphism. Thus $\psi$ is a holomorphic isomorphism of line bundles over $X$.
If $X$ is contractible, then its singular cohomology group $H^2(X,\mathbb{Z})$ is zero, so the preceding argument applies. Therefore every holomorphic line bundle on $X$ is holomorphically isomorphic to the product bundle $X \times \mathbb{C}$.
[/step]