I was wondering if someone would not mind proofreading my demonstration for the following problem. Any sentences in brackets [] will be omitted in the formal proof.
Problem
Let $B$ be a set, let $A_1, \dotsc, A_n$ be sets for some $n \in \mathbb{N}$ and let $h_i : B \rightarrow A_i$ be a function for each $i \in \{1,\dotsc,n\}$. Prove that there is a unique function $g:B\rightarrow A_1 \times \cdots \times A_n$ such that $\pi_i \circ g = h_i$ for all $i \in \{1,\dotsc, n\}$ where $\pi_i:A_1 \times \cdots A_n \rightarrow A_i$ is the projection map.
Proof
Existence
Set $I$ to be an indexing set such that $I = \{1,\dotsc,n\}$ for some $n \in \mathbb{N}$.
Let $h_i:B \rightarrow A_i$ for each $i \in I$. Let $b \in B$. Iterating through the values of $i$, we have a sequence of images $h_1(b), \dotsc, h_n(b)$. If the set $A_1 \times \dotsc \times A_n$ is a Cartesian product for each $A_i$, then the $n$-list $(h_1(b), \dotsc, h_n(b)) \in A_1 \times \dotsc \times A_n$. Thus, we have an ordered pair $(b,(h_1(b), \dotsc, h_n(b)))$. Define the relation $g:B \rightarrow A_1 \times \dotsc \times A_n$. Then $(b,(h_1(b), \dotsc, h_n(b))) \in g$.
To prove that $g$ is a function, we first note that for every $b \in B$, the function $h_i$ gaurantees the (unique) existence of an image $(h_1(b),\dotsc,h_n(b)) \in A_1 \times \dotsc \times A_n$. To prove uniqueness, let the images $x = g(b)$ and $y = g(b)$ for each $b \in B$ such that $x \neq y$. Thus, the n-lists $x = (h_1(b),\dots, h_n(b))$ and $y = (h_1(b),\dotsc, h_n(b))$ have at least one differing component $j$ where we denote $h_j(b)$ to be the $j^{th}$-component of $x$, and $h^*_j(b)$ to be the $j^{th}$ componenet of $y$. Therefore, $h_j(b) \neq h^*_j(b)$. But this implies that $h_j$ is not a function for an arbitrary $j \in I$, which is a contradiction.
Hence, $g$ is a function.
Now construct the composition $\pi_i \circ g: B \rightarrow A_i$. We will prove that $\pi_i \circ g = h_i$.
We first note that the domain and codomain of $\pi_i \circ g$ and $h_i$ are equal by construction.
We now prove that for all $b \in B$, we have $h_i(b) = \pi_i(g(b))$ for all $i \in I$
Choose any $m \in I$.
First, let $b \in B$. Then $h_m \in A_m$. By definition of $\pi_i \circ g$, the fact that $h_m \in A_m$ for an arbitrary $m \in I$ implies that $(b,h_m(b)) \in \pi_i \circ g$, so $h_i \subseteq \pi_i \circ g$.
Now, since we are assuming that $b \in B$, we have $g(b) \in A_1 \times \dotsc \times A_n$. Then applying $\pi_m$ to $g$, we deduce that $\pi(g(b)) \in A_m$. By definition of $h$, we must have $(b, \pi_m(g(b))) \in h_m$. Therefore, $\pi_i \circ g \subseteq h_i$.
We conclude that $\pi_i \circ g = h_i$ for each $i \in I$.
Uniqueness
Suppose to the contrary that there are two functions $g:B\rightarrow A_1 \times \dotsc \times A_n$ and $g':B\rightarrow A_1 \times \dotsc \times A_n$ such that $h_i = \pi_i \circ g$, $h_i = \pi_i \circ g'$ for all $i \in I$, and $g(b) \neq g'(b)$ for some $b\in B$ [This implies that some of the components of $g(b)$ and $g'(b)$ are not equal; recall that $g(b) \in A_1 \times \dotsc \times A_n$, which means that the element $g(b) = (a_1,\dotsc,a_n)$ for some $a_i \in A_i$]
Let $b \in B$. For each $m \in I$, we have $h_m(b) \in A_m$. From our premise, we know that $h_m = \pi_m(g(b))$ and $h_m = \pi_m(g'(b))$. We note that we cannot have $\pi_m(g(b)) \neq \pi_m(g(b))$, because then $h_m$ would not be a function. Hence, $\pi_m(g(b)) = \pi_m(g'(b))$.
However, observe that $\pi_m(g(b))$ is an arbitrary component of the preimage $g(b)$. Thus the equality $\pi_m(g(b)) = \pi_m(g'(b))$ implies that the components of $g(b)$ and $g'(b)$ are equal, entailing that $g(b) = g'(b)$.
Hence the function $g = g'$. Therefore, there exists a unique function $g: B \rightarrow A_1 \times \dotsc \times A_n$ such that $\pi_i \circ g = h_i$ for all $i \in I$.
$\blacksquare$
Your logic is correct, but you seem to think that if 1 word would do, 100 words would do better. This result is so trivial that I had read it twice just to figure what there even was to prove, and yet you've produced this massive edifice to prove it.
To show you the value of brevity, consider this proof:
Let $B$ be a set and let $h_i \ :\ B \to A_i$ be functions into sets $A_i$ for each $i \in \{1, ..., n\}$ for some $n$. Then there is a unique function $g\ :\ B \to A_1 \times ... \times A_n$ such that for all $i$, $\pi_i\circ g = h_i$, where $π_i\ :\ A_1\times ... \times A_n \to A_i$ is the projection map.
Proof:
Let $A = A_1 \times ... \times A_n$. For each $b \in B$ and each $i$, $h_i(b)$ has a unique value since $h_i$ is a function. $g(b)$ is thus uniquely defined by $$g(b) = (h_1(b), ..., h_n(b)).$$ Since $h_i(b) \in A_i$ for all $i$, $g(b) \in A$, and $\pi_i(g(b)) = h_i(b)$ by definition. Hence $g$ is a function from $B$ into $A$ such that $\pi_i\circ g = h_i$
Suppose $g'\ :\ B \to A$ also satisfies $\pi_i\circ g' = h_i$ for each $i$. Let $b \in B$. Then for all $i$, $$\pi_i(g'(b)) = h_i(b) = \pi_i(g(b)).$$ Therefore $g'(b) = g(b)$. Since $b$ was arbitrary, $g' = g$. Hence $g$ is unique.
Because it is shorter, it is much easier to follow. It doesn't belabor the obvious, but touches on all the points it needs to.