Hartshorne Exercise II.6.9(a): Picard group of a singular curve Exercise:

*6.9. Singular Curves. Here we give another method of calculating the Picard group of a singular curve. Let $X$ be a projective curve over $k$, let $\tilde{X}$ be its normalization, and let $\pi: \tilde{X} \rightarrow X$ be the projection map (Ex. 3.8). For each point $P \in X$, let $\mathcal{O}_{P}$ be its local ring, and let $\tilde{\mathcal O}_{P}$ be the integral closure of $\mathcal{O}_{P}$. We use a $*$ to denote the group of units in a ring.
(a) Show there is an exact sequence
$$
0 \rightarrow \bigoplus_{P \in X} \tilde{\mathcal{O}}_{P}^{*} / \mathcal{O}_{P}^{*} \rightarrow \operatorname{Pic} X \stackrel{\pi^{*}}{\rightarrow} \operatorname{Pic} \tilde{X} \rightarrow 0
$$
[Hint: Represent $\operatorname{Pic} X$ and $\operatorname{Pic} \tilde{X}$ as the groups of Cartier divisors modulo principal divisors, and use the exact sequence of sheaves on $X$
$$
\left.0 \rightarrow \pi_{*} \mathcal{O}_{\tilde{X}}^{*} / \mathcal{O}_{X}^{*} \rightarrow \mathscr{K}^{*} / \mathcal{O}_{X}^{*} \rightarrow \mathscr{K}^{*} / \pi_{*} \mathcal{O}_{\tilde{X}}^{*} \rightarrow 0 .\right]
$$

The exact sequence in the hint is trivial, and I have proved that $\pi_*\mathcal O_{\tilde X}^*/\mathcal O_X^*\simeq\oplus_{P\in X} \tilde{ \mathcal O}_P^*/ \mathcal O_P^*$（here we view $\tilde{ \mathcal O}_P^*/ \mathcal O_P^*$ as an skyscraper sheaf at $P$）. But then I cannot prove anything... (If you need the proof of the isomorphism I can provide it.)
Edit:
After reading KReiser's answer I think there is a more direct way to get the exact sequence. I will follow half of his answer.
After getting the following exact sequence:
$$
0\to \oplus_{P\in X} \tilde{ \mathcal O}_P^*/ \mathcal O_P^*\to \operatorname{Ca} X \stackrel{}{\rightarrow} \operatorname{Ca} \tilde{X} \to 0
$$
We then get a larger commutative diagram:
$$\require{AMScd}
\begin{CD}
0 @>>> 0 @>>> \mathcal O_X(X)^* =k^*@>>> \mathcal O_{\tilde X} (\tilde X)^*=k^*@>>> 0\\
@V{}VV @V{}VV @V{}VV @V{}VV\\
0 @>>> 0 @>>> \mathscr K^*(X) @>>> \mathscr K^*(X) @>>> 0\\
@V{}VV @V{}VV @V{}VV @V{}VV\\
0 @>>> \oplus_{P\in X} \tilde{ \mathcal O}_P^*/ \mathcal O_P^* @>>> \operatorname{Ca} X @>{p}>> \operatorname{Ca} \tilde{X}  @>>> 0\\
@V{}VV @V{}VV @V{}VV @V{}VV\\
0 @>>> \oplus_{P\in X} \tilde{ \mathcal O}_P^*/ \mathcal O_P^* @>{\phi}>> \operatorname{Pic} X @>{\pi^*}>> \operatorname{Pic} \tilde{X}@>>>0\\
@V{}VV @V{}VV @V{}VV @V{}VV\\
0 @>>> 0 @>>> 0 @>>> 0 @>>> 0
\end{CD}$$
All rows except the fourth are exact. By using snake lemma on the second and the third row(by viewing the first row as kernels and the fourth row as cokernels), we get the exactness of the fourth row (since there is a zero at the end of the first row.)
We are done.
 A: First, one preliminary note: we'll need to assume that either $\def\ol{\overline} k = \ol{k}$ or that $X$ is geometrically integral here. Either version of this gives that $\def\cO{\mathcal{O}}\cO_X(X)=k$, which is an important tool we'll need some ways on in the proof. $\def\Spec{\operatorname{Spec}} \def\Pic{\operatorname{Pic}} \def\cK{\mathcal{K}} \def\G{\Gamma}$

On any affine open $\Spec A\subset X$, we have that $(\pi_*\cO_{\widetilde{X}}^*)=\widetilde{A}$, the normalization of $A$, so $\cO_X^*\subset \pi_*\cO_{\widetilde{X}}^*$ as subsheaves of $\cK^*$.
We get an exact sequence of sheaves $0\to \pi_*\cO_{\widetilde{X}}^*/\cO_X^* \to \cK^*/\cO_X^*\to \cK^*/\pi_*\cO_{\widetilde{X}}^*\to 0$ on $X$ by the third isomorphism theorem.
As normalization is birational, we have that $\pi_*\cO_{\widetilde{X}}^*/\cO_X^*$ is supported on a proper closed subset of $X$, which is a finite set of points since we're working with a curve.
Since a sheaf on a finite discrete space is equal to the direct sum of the skyscraper sheaves of the stalks at each point, we have that $$\pi_*\cO_{\widetilde{X}}^*/\cO_X^*\cong \bigoplus_{P\in X} i_P((\pi_*\cO_{\widetilde{X}}^*)_P/\cO_{X,P}^*).$$
Next, by definition of $\cO_{\widetilde{X}}$ and the fact that integral closure commutes with localization, we have that $(\pi_*\cO_{\widetilde{X}})_P\cong \widetilde{\cO_{X,P}}$, and thus $\bigoplus_{P\in X} i_P((\pi_*\cO_{\widetilde{X}}^*)_P/\cO_{X,P}^*)\cong \bigoplus_{P\in X} i_P(\widetilde{\cO_{X,P}}^*/\cO_{X,P}^*)$, so our exact sequence of sheaves stands at $$0\to \bigoplus_{P\in X} i_P(\widetilde{\cO_{X,P}}^*/\cO_{X,P}^*) \to \cK_X^*/\cO_X^*\to \cK_X^*/\pi_*\cO_{\widetilde{X}}^*\to 0.$$
The next thing to do is to take global sections.
As $\G(X,\cK_X^*/\cO_X^*)\cong \operatorname{CaDiv} X$, we have that the middle term is isomorphic to $\operatorname{CaDiv} X$.
As a direct sum of skyscraper sheaves is flasque, we have that taking global sections of this sequence remains exact by exercise II.1.16(a).
Next, we argue that $\G(X,\cK_X^*/\pi_*\cO_{\widetilde{X}}^*)\cong \operatorname{CaDiv}(\widetilde{X})$: given a global section $\{(U_i,f_i)\}_{i\in I}$, we get that $\{(\pi^{-1}(U_i),f_i)\}_{i\in I}$ is a global section of $\cK_{\widetilde{X}}^*/\cO_{\widetilde{X}}^*$, so we have an injection $\G(X,\cK_X^*/\pi_*\cO_{\widetilde{X}}^*)\to \G(\widetilde{X},\cK_{\widetilde{X}}^*/\cO_{\widetilde{X}}^*)\cong \operatorname{CaDiv}(\widetilde{X})$.
To see this map is surjective, we know that by proposition II.6.11 the Weil and Cartier divisors on $\widetilde{X}$ are the same, so it suffices to show that we can represent any prime Weil divisor on $\widetilde{X}$ as a global section of $\cK_{\widetilde{X}}^*/\pi_*\cO_{\widetilde{X}}^*$.
Let $Q\in X$ be an arbitrary closed point and let $U\subset X$ be an affine open neighborhood of $Q$.
Consider the closed subscheme $$Y=\bigsqcup_{P\mapsto Q} (\{P\},\cO_{\widetilde{X},P}/(u_P^2))\subset \pi^{-1}(U)$$ where $u_P$ is a generator of the maximal ideal of $\cO_{\widetilde{X},P}$.
Since $\pi$ is affine, $\pi^{-1}(U)$ is affine and therefore the map $\cO_{\widetilde{X}}(\pi^{-1}(U)) \to \cO_Y(U)$ is surjective.
Let $s_P\in\cO_{\widetilde{X}}(\pi^{-1}(U))$ be a section which maps to $u_{P'}\in\cO_{\widetilde{X},P'}/(u_{P'}^2)$ if $P=P'$ and $1_{P'}\in\cO_{\widetilde{X},P'}/(u_{P'}^2)$ otherwise.
This section might have other zeroes on $\pi^{-1}(U)$, but none of them are at any point mapping to $Q$.
Because $\pi$ is finite and therefore closed, we may find a smaller open subset $U'\subset U$ which does not contain any point of $\pi(V(s_P))$ except for $Q$.
Then $\{(X\setminus Q,1),(U',s_P)\}$ is a global section of $\cK^*/\pi_*\cO_{\widetilde{X}}^*$ which has $P$ as its divisor, and we've shown that our map is indeed surjective.
So our exact sequence stands at $$0\to \bigoplus_{P\in X} \widetilde{\cO_{X,P}}^*/\cO_{X,P}^* \to \operatorname{CaDiv} X \to \operatorname{CaDiv} \widetilde{X} \to 0.$$
To get from here to the requested exact sequence, our goal is to mod out the group of principal Cartier divisors in $\operatorname{CaDiv} X$ and $\operatorname{CaDiv} \widetilde{X}$ without touching the first term in our exact sequence.
If we can do that, we're done by proposition II.6.15: $X$ and $\widetilde{X}$ are both integral, implying $\operatorname{CaCl} X\cong \Pic X$.
To be precise, we need to show that the image of our first term only has trivial intersection with the image $\G(X,\cK^*)=K(X)^*$ in $\operatorname{CaDiv} X$, or that the map $\operatorname{CaDiv} X\to \operatorname{CaDiv} \widetilde{X}$ doesn't send any nontrivial principal divisor to $0$.
If some element of $\bigoplus_{P\in X} \widetilde{\cO_P}^*/\cO_P^* $ has image the principal Cartier divisor associated to $f$ on $X$, then as $K(X)=K(\widetilde{X})$ and the map $\operatorname{CaDiv} X\to \operatorname{CaDiv} \widetilde{X}$ sends the principal Cartier divisor associated to $f\in K(X)$ on $X$ to the principal Cartier divisor associated to $f\in K(\widetilde{X})$ on $\widetilde{X}$, we need to show that any $f$ which determines a trivial Cartier divisor on $\widetilde{X}$ also determines a trivial Cartier divisor on $X$.
As any element $f$ of $K(\widetilde{X})^*$ determining the trivial Cartier divisor must be in $\cO_{\widetilde{X},x}^*$ for every $x\in X$, we have by proposition II.6.3 that $f$ is in $A$ for every affine open $\Spec A\subset \widetilde{X}$ and therefore $f$ is a global section.
By the preliminary note,  $\cO_X(X)=\cO_{\widetilde{X}}(\widetilde{X})=k$, so $f\in k^*$, which clearly determines the trivial Cartier divisor on $X$ too.
So quotienting out by principal Cartier divisors gives an exact sequence $$0\to \bigoplus_{P\in X} \widetilde{\cO_P}^*/\cO_P^* \to \Pic X\to \stackrel{\pi^*}{\to} \Pic \widetilde{X}\to 0$$ and we're done.
