Let $X_{2n}$ be the group whose presentation is$\langle x,y\,|\,x^n=y^2=1, xy=yx^2\rangle$. From $x=xy^2$, it is seen that $x^3=1$, hence $X_{2n}$ has at most $6$ elements. I have to show that if $n=3k$, then $X_{2n}$ has exactly $6$ elements.
I can't see where I am having problem if I assume $x=1$.
The elements $x=(1,2,3)$ and $y=(2,3)$ of $S_3$ satisfy the three relations when $n=3k$, and $S_3$ has order $6$ and is generated by $x$ and $y$. So $|X_{2n}| \ge 6$ when $n=3k$.
Also, the relations can be used to write any element of $X_{2n}$ in the form $x^ay^b$, the fact that $x^3=y^2=1$ in $X_{2n}$ proves that $|X_{2n}| \le 6$ for all $n$.
So $|X_{2n}|=6$ when $n=3k$.