Proof (universal property of amalgamated free product)

Define a homomorphism $\hat ϕ: F(S_1 \cup S_2)\to K$ via $$ \begin{align*} S_1 \cup S_2 &\to K \\ s\in S_1 &\mapsto ϕ_1(q_1((s))), \\ s\in S_2 &\mapsto ϕ_2(q_2((s))) \\ \end{align*} $$ where $q_i: F(S_i)\to \langle S_i\mid R_i\rangle$ are the quotient maps.

Note for $r_i \in R_i$, we have $\hat ϕ(r_i) = ϕ_i(q_i(r_i)) = ϕ_i(e) = e$, so $R_1 \cup R_2 \subseteq \ker \hat ϕ$ and hence $\hat ϕ$ descends to $\tilde ϕ: G_1 * G_2 = F(S_1 \cup S_2) / \langle \langle R_1 \cup R_2\rangle\rangle\to K$.

Moreover for $h\in H$, $$ \begin{align*} \tilde ϕ(j_1(i_1(h))\cdot (j_2(i_2(h)))\inv) = \tilde ϕ(j_1(i_1(h))) \cdot \tilde ϕ(j_2(i_2(h)))\inv = ϕ_1(i_1(h)) \cdot ϕ_2(i_2(h))\inv = e \end{align*} $$ since $ϕ_1 \circ i_1 = ϕ_2 \circ i_2$. Thus we obtain a homomorphism $ϕ: G_1 *_H G_2 \to K$ as required.