Consider the Cartier divisor $D=\Sigma p_kD_k-\Sigma n_lE_l$ ( with $p_k, n_l>0$ ) and a covering $(U_i)$ of $X$ such that on each $U_i$ the Cartier divisor $D\cap U_i$ is given by a rational function $f_i\in \mathcal {Rat}(U_i)$. The line bundle $\mathcal L=\mathcal O(D)$ may be defined by the Cech cocycle $g_{ij}=f_i/f_j \in \mathcal O^\ast(U_i\cap U_j)$.
A better, more concrete, description of $\mathcal L =\mathcal O(D)$ is that as a sheaf it is the sub-$\mathcal O_X$-Module $\mathcal L\subset \mathcal {Rat}_X$ which restricted to $U_i$ equals $\mathcal L |U_i=\frac{1}{f_i} \mathcal O_{U_i}$.
The line bundle $\mathcal L$ then has a canonical rational section $s=1 \in \Gamma(X, \mathcal L)\subset \mathcal Rat(X)$. We have trivializations of $\mathcal L$ attached to our data, namely $\mathcal L|U_i \stackrel {\simeq}{\longrightarrow} \mathcal O_{U_i}:g\mapsto gf_i$, mapping $s|u_i=1\in \Gamma(U_i, \mathcal L)$ to $f_i\in \Gamma (U_i,\mathcal {Rat}(U_i))$ And now it is completely tautological that the divisor of $s$ is $D$, since that divisor is given by the $f_i$'s on $U_i$.
Remarks
1) As you see, the fact that $X$ is projective is actually irrelevant.
2) The construction works on any scheme, however singular it may be, as long as you consider Cartier divisors.
3) If your scheme is separated, noetherian, integral and locally factorial, you can indeed associate to each Weil divisor a unique Cartier divisor and then apply the preceding considerations. But this is rather a different issue: your question is really about cartier divisors.