Product in the Category of $L$-structures with Homomorphisms. let $\scr {A}_1$, and $\scr {A}_2$ be $L$-structures. Define an L-structure $\scr A_1 \times \scr A_2$ with universe $A_1 \times A_2$, such that the natural epimorphism $\pi_i :\scr A_1 \times \scr A_2 \to \scr A_i $ for $i=1,2$ satisfy the following universal property:
given any $L$-structure $\scr D$ and homomorphisms $\phi _i : \scr D \to \scr A_i$ for $i=1,2$, there is a unique homomorphism $\psi : \scr D \to \scr A_1 \times \scr A_2 $ such that $\pi_i(\psi)=\phi_i$ for $i=1,2$
This notion also popped up in a category theory book I stumbled upon. However, it was taken as an axiom without any further explanation.
Construction:
Let $\scr A_1,A_2$ be two $L$-structures with $f_i^{\scr A_i} \in \scr A_i$.
Define $\scr A_1 \times \scr A_2$ as $\langle A_1 \times A_2, \pi_i \rangle$ including constants induced by $f_i$ and relation on each $A_i$
Define
$\pi_i: A_1 \times A_2 \to A_i$, as follows,
$\pi_i=\{(a,f(a))| a,f(a)\in \scr A_i\}$ with $i=1,2$
Will this work?
 A: What you've written in the construction section makes no sense to me. Most of it doesn't even parse correctly.
The task is to define an $L$-structure $\mathscr{A}_1\times \mathscr{A}_2$. You are told that the universe of this structure should be the cartesian product $A_1\times A_2$. It remains to define, for each symbol in the language, an interpretation of that symbol on $A_1\times A_2$.
You don't need to define $\pi_1$ and $\pi_2$: the "natural epimorphisms" referred to in the question are just the projections onto each coordinate. So $\pi_1\colon A_1\times A_2\to A_1$ is defined by $\pi_1(a_1,a_2) = a_1$, and $\pi_2\colon A_1\times A_2\to A_2$ is defined by $\pi_2(a_1,a_2) = a_2$.
Ok, let's say we have a constant symbol $c$ in the language. Then we have elements $c^{\mathscr{A}_1}\in A_1$ and $c^{\mathscr{A}_2}\in A_2$. We want to interpret $c^{\mathscr{A}_1\times \mathscr{A}_2}$ as an element of $A_1\times A_2$. Which element shall we pick? There's really only one reasonable choice: $c^{\mathscr{A}_1\times \mathscr{A}_2} = (c^{\mathscr{A}_1},c^{\mathscr{A}_2})$.
Now let's say we have an $n$-ary function symbol $f$ in the language. Then we have functions $f^{\mathscr{A}_1}\colon A_1^n\to A_1$ and $f^{\mathscr{A}_2}\colon A_2^n\to A_2$. We want to interpret $f^{\mathscr{A}_1\times \mathscr{A}_2}$ as a function $(A_1\times A_2)^n\to (A_1\times A_2)$. Again, there's really only one reasonable choice: $f^{\mathscr{A}_1\times \mathscr{A}_2}((a_1,a_1'),\dots,(a_n,a_n')) = (f^{\mathscr{A}_1}(a_1,\dots,a_n),f^{\mathscr{A}_2}(a_1',\dots,a_n'))$.
Finally, let's say we have an $n$-ary relation symbol $R$ in the language. Then we have relations $R^{\mathscr{A}_1}\subseteq A_1^n$ and $R^{\mathscr{A}_2}\subseteq  A_2^n$. We want to interpret $R^{\mathscr{A}_1\times \mathscr{A}_2}$ as a subset of $(A_1\times A_2)^n$. This time it's not so obvious what to choose, but the right choice is still the most natural one: $((a_1,a_1'),\dots,(a_n,a_n'))\in R^{\mathscr{A}_1\times \mathscr{A}_2}$ if and only if $(a_1,\dots,a_n)\in R^{\mathscr{A}_1}$ and $(a_1',\dots,a_n')\in R^{\mathscr{A}_2}$.
The above defines the $L$-structure $\mathscr{A}_1\times \mathscr{A}_2$. Having given you the construction, I'll leave it to you to try to verify the universal property.
