Let $k$ be a field and $X=A^1$ be the affine $k$-line. Let $D$ be the Weil divisor on $A^1$ given by $-2[(x)]+[(x-1)]+[(x-2)]$. I wish to show that $O_X(D)\cong O_X$ as sheaves.
I have shown that any global section of $O_X(D)$ is a $k[x]$-multiple of $\frac{x^2}{(x-1)(x-2)}$. But I am struggling to see how this helps me proceed. I must define morphisms $\phi_U:O_X(D)(U)\to O_X(U)$ for all open $U\subset A^1$. I'm not even sure what these morphisms should be. On global sections, my guess was that you just send a element $t\in O_X(D)(X)$ to $f$ where $f\cdot \frac{x^2}{(x-1)(x-2)}=t$ and this indeed is bijective. But I'm not sure where to send any local sections in general. I know that for $t\in O_X(D)(U)$, we can write $f\cdot \xi=t$ where $\xi$ is roughly the function $\frac{x^2}{(x-1)(x-2)}$ (except with some factors removed depending on whether $U$ contains $0,1,2$ appropriately). The proof for this is the same as the proof that any global section of $O_X(D)$ is a $k[x]$-multiple of $\frac{x^2}{(x-1)(x-2)}$. But letting $\phi_U$ map $t$ to $\xi$ doesn't seem to be compatible with restrictions. This also doesn't seem to be surjective.
Am I making a stupid mistakes? Any and all help would be appreciated. I know this statement also follows from more general theorem, but I wish to do this by hand.
Take the royal road: on $\mathbb A^1_k$ every Weil divisor $D$ is principal, so that $\mathcal O_X(D)\cong \mathcal O_X$.
Reason: The ring $k[T]$ corresponding to the affine line is a noetherian unique factorization domain (UFD) and thus the class group $Cl(\mathbb A^1_k)$is trivial, which means that every Weil divisor is principal.
Reference: Proposition 6.2, chapter II, page 131 of Hartshorne's Algebraic Geometry.