Understanding the exact sequence $\Bbb{Z}\to \text{Pic}(X)\to \text{Pic}(U)\to 0$ The following is an exercise from pg 5 of this document on Picard Groups:

Let $Z$ be a prime divisor in a smooth variety $X$, and let $U$ denote the complement $X\setminus Z$. Show that the sequence $$\Bbb{Z}\to \text{Pic}(X)\to \text{Pic}(U)\to 0$$ is exact. The map from $\Bbb{Z}\to \text{Pic}(X)$ is of the form $1\to Z$, where $Z$ is the previously chosen prime divisor.
Now use this result to prove that $\text{Pic}(\Bbb{P}^n)=\Bbb{Z}$ for any $n\in\Bbb{N}$.

I may be doing this wrong, but I think the map from $\Bbb{Z}$ to $\text{Pic}(X)$ is the zero map, as $Z$ corresponds to a principal divisor in $\text{Div}(X)$. Also, the map $\text{Pix}(X)\to \text{Pic}(U)$ is the identity map.
If both of these are true, which I don't think they are, then I have no way of proving that $\text{Pic}(\Bbb{P}^n)=\Bbb{Z}$. Am I understanding the exact sequence given above incorrectly.
 A: $Z$ has no reason to be a principal divisor, e.g if $Z \subset \Bbb P^2$ is a line. In any case you have a map $\Bbb Z \to Pic(X), 1 \mapsto [Z]$.
The map $Pic(X) \to Pic(U)$ is given by restriction :$D \mapsto D \cap U$ where $D$ is  a prime divisor and extend by linearity. In particular the composition is zero and your sequence is indeed exact. Surjectivity is because any divisor $D \subset U$ can be extended to a divisor $\tilde D \subset X$ (just take the closure). 
Now $Pic(\Bbb A^n) = 0$ because $k[x_1, \dots, x_n]$ is a UFD. So you have a surjection $\Bbb Z \to Pic(\Bbb P^n)$ by taking the image of an hyperplane, and it's easy to see that this map is a bijection.
A: The simplest example is  when $X$ is a smooth  projective curve , say over $\mathbb C$.
Then a prime divisor is just a single point $P\in X$ and the group morphism $$j:\mathbb Z\to \operatorname {Pic(X)}:n\mapsto [nP]$$ is injective.
Reason: any principal divisor $$\operatorname {div}f=\sum n_iP_i\in \operatorname {Prin}(X)\subset \operatorname {Div(X)}$$ has degree $\sum n_i=0$, so that $nP$ can be principal only if $n=0.$
But is  $j$ surjective?
$\bullet$If the genus of $X$ is zero, i.e. if $X=\mathbb P^1$, we get an isomorphism $j:\mathbb Z\stackrel{\cong}{\to}\operatorname {Pic(X)}$
Reason: $\operatorname {Pic(U)}=\operatorname {Pic(\mathbb A^1)}=0$ because $\mathcal O(\mathbb A^1)=\mathbb C[T]$ and a UFD has zero Picard group. 
$\bullet \bullet$ If $X$ has positive genus $g$, then $j$ is not surjective.
Reason: $\operatorname {Pic(X)}$ is non denumerable. More precisely: the group $\operatorname {Pic(X)}$ can be endowed with the structure of a (non-connected) smooth complex variety of dimension $g$ (this is a non-trivial result).
Remarks
 1) Note carefully that the injectivity of $j$ prevents (for any value of the genus $g$) the group morphism $\operatorname {Pic(X)}\to \operatorname {Pic(U)}$ from being bijective (contrary to what you thought according to the ninth line of your question).
2) If $X$ is not a smooth projective curve $j$ has no reason to be injective.
The simplest counterexample is for $X=\mathbb A^1$: as I mentioned above $\operatorname {Pic}(\mathbb A^1)=0$, so that $j:\mathbb Z\to \operatorname {Pic}(\mathbb A^1)=0$ is definitely not injective!
