Let's say that your (compact!) Riemann surface is $X$ (of genus at least $1$). What does it mean to say that $J^{g-1}$ is the "variety of degree $g-1$ line bundles?" One way to formalize this is to say that there is a line bundle $\mathcal{L}$ on the product $X \times J^{g-1}$ with the property the rule $p \mapsto \mathcal{L}|_{X \times \{ p \}}$ defines a bijection between the ($\mathbb{C}$-valued) points of $J^{g-1}$ and the line bundles of degree $g-1$. (A stronger statement is that $J^{g-1}$ represents the Picard functor, but I'm going to try to sweep this under the run.)
Let $\pi \colon X \times J^{g-1} \to J^{g-1}$ denote the projection maps. Recall that the formation of the direct image $\pi_{*}(\mathcal{L})$ does not always commute with passing to a fiber. However, the theory of cohomology and base change describes how the fiber-wise cohomology of $\mathcal{L}$ varies. The main theorem states that there is a 2-term complex of vector bundles
$d \colon \mathcal{E}_0 \to \mathcal{E}_1$
that computes the cohomology of $\mathcal{L}$ universally. That is, for all morphisms $T \to J^{g-1}$, we have
$\operatorname{ker}(d_{T}) = (\pi_{T})_{*}(\mathcal{L}_{X \times T})$
and
$\operatorname{cok}(d_{T}) = (R^{1}\pi_{T})_{*}(\mathcal{L}_{X \times T}).$
(The most important case is where $T = \operatorname{Spec}(\mathbb{C})$ and
$T \to J^{g-1}$ is the inclusion of a point.)
The complex $\mathcal{E}_{\cdot}$ is not unique, but any other complex of vector bundles with this property must be quasi-isomorphic.
In the literature, many authors construct a complex $\mathcal{E}_{\cdot}$ using an explicit procedure, but the existence is a very general theorem. I learned about this topic from Illusie's article "Grothendieck's existence theorem in formal geometry," which states the base change theorems in great generality.
In your question, you described how to convert the complex into a line bundle (take the difference of top exterior powers). But now we must check that two quasi-isomorphic complexes have isomorphic determinant line bundles. This can be checked by hand, but this statement has been proven in great generality by Mumford and Knudsen (see MR1914072 or MR0437541). The determinant of the complex $\mathcal{E}_{\cdot}$ is exactly the line bundle you are asking about.
One subtle issue is that the universal line bundle $\mathcal{L}$ is NOT uniquely determined. If $\mathcal{M}$ is any line bundle on $J^{g-1}$, then
$\mathcal{L} \otimes \pi^{-1}(\mathcal{M})$ also parameterizes the degree $g-1$ line bundles in the sense described above (and in a stronger sense that I am sweeping under the rug). However, one can show that $\mathcal{L}$ and $\mathcal{L} \otimes p^{*}(\mathcal{M})$ have isomorphic determinants of cohomology by using the fact that a degree $g-1$ line bundle has Euler characteristic equal to zero.