I did not know how to lift the obvious isomorphism $\mathcal O_X(D)_Y \cong \mathcal O_{X,Y}$ at a codimension-1 point $Y$ to an isomorphism of a neighborhood of $Y$. Ultimately, it is possible to do this because the total ring of fractions gives a single realm for considering functions coming from different sources.
Replace $X$ by one of its affine neighborhoods of $p.$ Since $X$ is regular in codimension 1, $\mathcal O_{X,Y}$ is a DVR. Any uniformizer $f_Y$ can be considered in $K(X).$ It can be shown that the prime Weil divisors of $X$ through $p$ correspond bijectively to inject into the prime Weil divisors of $Spec(\mathcal O_{X,p}),$ so $Y$ is the only component of the divisor of $f_Y$ considered as a function on $X$. Let $$U_Y := X\setminus \{\text{all components of $div(f)$ except $Y$}\}.$$ Then, letting $e_Y := v_Y(s),$ the open set $U := \bigcap_{Y\ni p} U_Y$ is a neighborhood of $p$ on which
$$t\longmapsto t\prod_{Y\ni p}f_Y^{-e_Y}$$
is an isomorphism $\mathcal O_X(D)(U)\longrightarrow \mathcal O_X(U).$ From here it is straightforward to prove that in fact $\mathcal O_X(D)\rvert_U \cong \mathcal O_U$ for all $U$ in a base for the topology on $X$, and the rest of the exercise follows.
Suppose $U\subseteq X$ is an open subset on which $\mathcal{L}$ is trivial. It is enough to show that the map
\begin{align*}
e(U) : \mathscr{H}om(\mathcal{L},\mathcal{O})(U)&\to\mathcal{O}(U)\\
\phi &\mapsto \phi\circ s(1)
\end{align*}
is injective for any such $U.$ (By the way, make sure you convince yourself that this is indeed enough -- a morphism of sheaves $\mathcal{F}\to\mathcal{G}$ on a space $X$ such that $\mathcal{F}(U)\to\mathcal{G}(U)$ is injective for all $U$ in some open cover of $X$ need not be an injective morphism of sheaves!)
On $U,$ we have $$\mathscr{H}om(\mathcal{L},\mathcal{O})(U) =\operatorname{Hom}(\left.\mathcal{L}\right|_U,\mathcal{O}_U) \cong\operatorname{Hom}(\mathcal{O}_{U},\mathcal{O}_{U})\cong\mathcal{O}(U).$$ The final isomorphism here is given by $\phi\mapsto\phi(1).$
So, now we're looking at a map
$$
\mathcal{O}(U)\to\mathcal{O}(U),
$$
and to describe such an $\mathcal{O}(U)$-module map, it suffices to specify where $1$ goes. Under the isomorphism $\operatorname{Hom}(\mathcal{O}_{U},\mathcal{O}_{U})\cong\mathcal{O}(U),$ $1$ corresponds to the identity morphism. So, we must compute $e(U)(\operatorname{id}),$ which is the image of $1\in\mathcal{O}(U)$ under the composition
$$
\mathcal{O}(U)\xrightarrow{s}\mathcal{L}(U)\cong\mathcal{O}(U)\xrightarrow{\operatorname{id}}\mathcal{O}(U).
$$
Let $f$ be the image of $s(1)\in\mathcal{L}(U)$ in $\mathcal{O}(U)$ under the isomorphism $\mathcal{L}(U)\cong\mathcal{O}(U).$ Then we have $e(U)(\operatorname{id}) = f.$ Tracing everything out, this means that the map $e(U) : \mathcal{O}(U)\to\mathcal{O}(U)$ is nothing more than multiplication by $f.$ Now here's the key -- $s$ being injective means that $s(1) = f\in\mathcal{O}(U)$ is a nonzero divisor, so the map $e(U)$ is injective, as desired!
As Samiron suggests in the comment above, this may all be more simply put as follows. Recall that $\mathscr{H}om(\mathcal{L},\mathcal{O}) = \mathcal{L}^{-1},$ and that $\mathcal{L}^{-1}\otimes\mathcal{L}\cong\mathcal{O}.$ Then the map you define $$\mathscr{H}om(\mathcal{L},\mathcal{O})\to\mathcal{O}$$ is nothing more than the map you obtain by tensoring the given regular section $s : \mathcal{O}\to\mathcal{L}$ by $\mathcal{L}^{-1}.$ This produces a map $\mathcal{L}^{-1}\to\mathcal{O},$ which is still injective because $\mathcal{L}^{-1}$ is locally free (hence flat).
Best Answer
Instead of taking $\eta$ to be the generic point of $Y$, one should take $\eta$ to be the generic point of $X$. Then the composite $$\mathcal{L}(U)\to \mathcal{L}_\eta \to \mathcal{O}_\eta = K(X)$$ sends $s$ to an element of $K(X)$ and one applies the valuation corresponding to $Y$ inside $K(X)$.