The problem was to prove that $A_n$ is the only subgroup of $S_n$ of index 2. I am aware of the fact that there are multiple posts on this question, but I was wondering why this particular method I thought of fails.
Suppose that $G \not= A_n$ is a subgroup of $S_n$ of index 2. Then there is one other coset of $G$, which is $S_n - G$ ($-$ is the set difference operator). Then we must have that there is some $x$ in $S_n - G$ that is even. Then the coset $x^{-1}(S_n - G) = G$, and since the sign map is a homomorphism, we have that $S_n - G$ and $G$ have the same number of even and odd elements. So $G$ contains half of $A_n$.
However, in order to achieve the contradiction, we must show that half of $A_n$ will generate $G$, that is, there is no subgroup of $A_n$ of index 2. However, from searching on google, apparently this is only true of $n$ is prime. My question is exactly where did I make the flaw and is there any way to resolve it?