Is my proof that every group of order 4 is abelian correct? Prove that every group of order 4 is abelian.
My solution goes like this:

We consider a group $G=\{e,a_1,a_2,a_3\}$ and a homomorphism from $f:G\longrightarrow \Bbb Z_2\times \Bbb Z_2$ such that $f(e)=(0,0),f(a_1)=(0,1),f(a_2)=(1,0),f(a_3)=(1,1).$ Now, $f$ is a homomorphism indeed as $\forall a,b\in G$, $f(ab)=f(a)+f(b)$ and $f$ is onto and injective due to which it's an isomorphism and hence $G\cong \Bbb Z_2\times \Bbb Z_2 .$ Now, since $ \Bbb Z_2\times \Bbb Z_2 $ is abelian, $G$ is also abelian.

Is the above solution correct? If not, where is it going wrong?
I know there are numerous posts on this topic in this site but I want to verify whether this particular solution can be considered valid or not.
EDIT: Thank you everyone! I finally got the answer that why this solution is not valid as Mariano Suárez-Álvarez along with many others pointed out. The problem is resolved!
 A: $\mathbb{Z}_4$ does have a homomorphism going to $\mathbb{Z}_2 \times \mathbb{Z}_2$, but that homomorphism is not surjective.
Consider $g$, a generator of $\mathbb{Z}_4$. It has order $4$, but every element of $\mathbb{Z}_2 \times \mathbb{Z}_2$ has order $2$, therefore $\{e, g, gg, g^3\}$ must be sent to a subgroup of $\mathbb{Z}_2 \times \mathbb{Z}_2$ with cardinality $2$.

Here's a proof that every group of order $4$ is Abelian that starts with the assumption that $G$ has order $4$ and works out which group it has to be based on the possible orders of elements.
Suppose we have a group $G$ of order $4$, call its elements $e, a, b, c$.
Suppose $G$ has an element of $4$. Suppose without loss of generality, that $a$ has order $4$, then $G$ is the cyclic group of order $4$ and is Abelian.
Suppose that $G$ does not have an element of order $4$, then $a, b, c$ have order $2$.
Let's consider possible values for $ab$. $ab$ cannot equal $e$ since $a$ is its own inverse. $ab$ cannot equal $a$ because then $b$ would be $e$. $ab$ cannot equal $b$ because then $a$ would be $e$. So $ab$ must equal $c$.
By a similar argument, for any distinct $x$ and $y$ from $\{a, b, c\}$, $xy$ is equal to the $\{a, b, c\} \setminus \{x, y\}$.
Therefore $G$ is $\mathbb{Z}_2 \times \mathbb{Z}_2$ and thus Abelian.
A: Actually, the solution given on the post is wrong solely because $f$ is actually not a homomorphism as pointed out by Mariano Suárez-Álvarez in the comment section. That's because when I try to prove $f$ as a homomorphism, it rather becomes a fake-proof because:

$f(a_1a_2)=f(a_1)+f(a_2),\forall a,b\in G$ must be the condition that must be satisfied in order that $f$ becomes a homomorphism. But we, never know what $a_1a_2$ is actually? It might be $a_3$, might be $e,$ this is where it goes wrong. In the above case, $f(a_1)+f(a_2)=(1,1)$ this is true only if $f(a_1a_2=a_3)=(1,1)$. Although, $f(a_3)=(1,1)$, but $a_1a_2$ might not be $a_3$, it might be $e$ as well. But since $G$ is an arbitary group, we can never conclude or rather assert $a_1a_2=a_3$.

A: It's not true that $G\cong \Bbb Z_2×\Bbb Z_2$.  $\Bbb Z_4$ has order $4$.  One group is cyclic,  the other isn't.   So they're not isomorphic.

If you look into a Cayley table,  you will find that there's only two ways to fill one out for a group of order $4$ (up to relabeling).  Both are symmetric about the diagonal,  meaning both groups are abelian.
There's $16$ squares to fill in.   And every element must appear in each row and column.

Alternatively,  either the group is cyclic or it has exponent $2$.
Theorem:  Any group $G$ of exponent $2$ is abelian.
Proof:   $e=(xy)^2=xyxy=xyx^{-1}y^{-1},\forall x,y\in G.$
A: Without any appeal to orders of elements, Cauchy's Theorem of Lagrange's or type of group: assume that $G$ has $4$ elements and is not abelian. Then we can find two non-identity elements $a,b$ that do not commute, so $ab \neq ba$. Note that this implies $ab \notin \{e,a,b\}$. Because $G$ is closed under the group operation we must have $G=\{e,a,b,ab\}$. Now $ba$ belongs to this set. Since $a$ and $b$ do not commute $ba \notin \{e,a,b\}$. Hence we must have $ab=ba$, a contradiction. So $G$ is abelian after all.
