Well-definedness of the tensor product of two algebras.

It has been stated as a definition in my book that if $A$ and $B$ are $R$-algebras, the tensor product module $A \otimes B$ has a well-defined multiplication defined by

$$(a \otimes b)(a' \otimes b')=aa'\otimes bb',\ a,a' \in A,\ b, b' \in B.$$

This makes $A \otimes B$ into an $R$-algebra, called the tensor product of the algebras $A$ and $B$.

How is that map well-defined? I know somehow I have to use the universal property of tensor product. In order to do that I need a bilinear map which induces a linear map and that linear map can be extended to the desired map. But what is that bilinear map that will serve my purpose? I have tried constructing it by first fixing two elements let's say $a \in A$ and $b \in B$. Then I define a map from $A \times B$ to $A \otimes B$ by sending $(x,y)$ to $ax \otimes by$. Clearly this map is bilinear. That will induce a $R$-linear map from $A \otimes B$ to $A \otimes B$ defined by $x \otimes y \mapsto ax \otimes by$. Does that help? If so how?

Thank you very much.

Since $A$ and $B$ are two algebras so there exist bilinear maps from $A \times A$ to $A$ and $B \times B$ to $B$. These two bilinear maps induce two linear maps $m_A : A \otimes A \longrightarrow A$ and $m_B : B \otimes B \longrightarrow B$ defined by $$m_A(a \otimes a')=aa'$$ and $$m_B(b \otimes b')=bb'$$ respectively. This induces a linear map $m_A \otimes m_B : (A \otimes A) \otimes (B \otimes B) \longrightarrow A \otimes B$ defined by $$(m_A \otimes m_B) ((a \otimes a') \otimes (b \otimes b')) = m_A(a \otimes a') \otimes m_B(b \otimes b') = aa' \otimes bb'.$$
Now from the associativity and commutativity properties of tensor product there is a natural isomorphism $f : (A \otimes B) \otimes (A \otimes B) \longrightarrow (A \otimes A) \otimes ( B \otimes B)$ defined by
$$f((a \otimes b) \otimes (a' \otimes b')) = (a \otimes a') \otimes (b \otimes b').$$
Consider a map $g : (A \otimes B) \times (A\otimes B) \longrightarrow (A \otimes B) \otimes (A\otimes B)$ defined by $$g((a\otimes b),(a' \otimes b')):=(a \otimes b) \otimes (a' \otimes b').$$ This map is clearly well defined.
Then the map $h:=(m_A \otimes m_B) \circ f \circ g: (A \otimes B) \times (A \otimes B) \longrightarrow A \otimes B$ defined by $$g((a \otimes b),(a' \otimes b')) = aa' \otimes bb'$$ gives the required well-defined multiplication in $A \otimes B$.