Exercise II.2.12 from Hartshorne's Algebraic Geometry book (i.e. the Glueing Lemma) presents the following
II.2.12. Let $\left\{X_i\right\}$ be a family of schemes (possibly infinite). For each $i\ne j$ suppose given an open subset $U_{i,j}\subset X_i$, and let it have the induced scheme structure. Suppose also given for each $i\ne j$ an isomorphism of schemes $\varphi_{i,j}: U_{i,j}\to U_{j,i}$ such that
(1) For each $i\ne j$, $\varphi_{i,j} = \varphi_{j,i}^{-1}$, and
(2) for each $i,j,k$, $\varphi_{i,j}\left(U_{i,j}\cap U_{i,k}\right) = U_{j,i}\cap U_{j,k}$ and $\varphi_{i,k} = \varphi_{j,k} \circ \varphi_{i,j}$ on $U_{i,j} \cap U_{i,k}$.
Then show that there is a scheme $X$, together with morphisms $\psi_i:X_i \to X$ for each $i$, such that
(1) $\psi_i$ is an isomorphism of $X_i$ onto an open subscheme of $X$
(2) the $\psi_i(X_i)$ cover $X$,
(3) $\psi_i(U_{i,j}) = \psi_i(X_i) \cap \psi_j(X_j)$ and
(4) $\psi_i = \psi_j \circ \varphi_{i,j}$ on $U_{i,j}.$
My assumption is that the main tool for attacking this problem is Hartshorne's Exercise II.1.22 (included below) but I am running into issues reconciling intuition with language.
II.1.22. (Glueing Sheaves.) Let $X$ be a topological space, let $\left\{ U_i\right\}$ be an open cover of $X$, and suppose we are given for each $i$ a sheaf $\mathcal{F}_i$ on $U_i$, and for each $i,j$ an isomorphism $\varphi_{i,j}: \mathcal{F}_i|_{U_i\cap U_j} \to \mathcal{F}_j|_{U_i\cap U_j}$ such that
(1) for each $i$, $\varphi_{i,i}=id$, and
(2) for each $i,j,k$, $\varphi_{i,k} = \varphi_{j,k}\circ \varphi_{i,j}$ on $U_i \cap U_j \cap U_k$.
Then there exists a unique sheaf $\mathcal{F}$ on $X$, together with isomorphisms $\psi_i : \mathcal{F}|_{U_i} \to \mathcal{F}_i$ such that for each $i,j$, $\psi_j = \varphi_{i,j}\circ \psi_i$ on $U_i\cap U_j$.
The approach I am taking is as follows. Any guidance on how to amend my approach or rectify the language therein would be much appreciated :D
"Proof" of II.2.12:
To begin, let $Y = \bigsqcup X_i$ and define an equivalence relation on $Y$ by $y_1 \sim y_2$ if either $y_1=y_2$ or there exists some pair $i,j$ such that $y_1 = \varphi_{i,j}(y_2)$. (As this is not a part I have struggled with, I will spare everyone the proof this is an equivalence relation.)
Let $X$ be the quotient of $Y$ with respect to $\sim$ with the quotient topology. Observe that the image of each $X_i$ is an open subset of $X$ as its preimage in $Y$ is exactly $$ X_i \sqcup \left( \bigsqcup_{j\ne i} U_{j,i} \right). $$
Let $\iota_i$ be the natural embedding of $X_i$ into $X$. Being a continuous map for each $i$, we can thus construct the direct image sheaf on $\iota_i(X_i)$ $$ \mathcal{F}_i:= \iota_{i,*}\left( \mathcal{O}_{X_i} \right) $$ Note that $\left\{V_i:=\iota_i(X_i)\right\}$ does indeed give an open cover of $X$ as required, and the direct image sheaves give the family of sheaves $\mathcal{F}_i$.
Further note that for each $i\ne j$ $$ V_i \cap V_j = \iota_i\left( U_{i,j} \right) = \iota_j\left( U_{j,i} \right) $$ as this is exactly where the embeddings of $X_i,X_j$ meet in the quotient. Since each $\varphi_{i,j}:U_{i,j} \to U_{j,i}$ is an isomorphism we indeed have $$ \varphi_{i,j}: \mathcal{F}_i|_{V_i \cap V_j} \to \mathcal{F}_j|_{V_i \cap V_j}. $$ Thus we can finally construct a sheaf $\mathcal{F}$ on $X$ and isomorphisms $\psi_i: \mathcal{F}|_{V_i} \to \mathcal{F}_i$ such that for each $i,j$, $\psi_j = \varphi_{i,j}\circ \psi_i$ on $V_i\cap V_j$. So as to match the requested direction from II.2.12, we concern ourselves with the inverses of $\psi_i$ instead and observe $$ \psi_i^{-1} = \psi_j^{-1} \circ\psi_j \circ \psi_{i}^{-1} = \psi_{j}^{-1} \circ \varphi_{i,j} $$ on $\iota_i^{-1}\left(V_i\cap V_j\right) = U_{i,j}$
Thus all required conditions are satisfied as the map of topological spaces that $\psi_i^{-1}$ induces are exactly the embeddings $\iota_i$.
While I think this is the right idea, possibly even a correct proof, the language involved and all the underlying maps/sets (especially the need to transition from an embedding of each set $X_i$ in the set $X$ to the image of each scheme $X_i$ as an open subscheme of $X$) have put me in a position when I am finding myself lacking the required intuition to properly assert that I have done anything beyond thrown symbols at the wall and called it a day.
I imagine I am just forgetting the existence of some nice theorem (or exercise) that would serve to clear up the transition from talking about sets to talking about schemes.
Any help would be greatly appreciated. Thank you much! :D