First I will show that with small modifications, your approach can be made to work. (It is, however, simpler to use one of the methods in other answers.) At the end, I suggest an additional simple approach.
It is clear that $x^2+x+1 \ge 1$ if $x \ge 0$. There is potential trouble only when $x<$, so suppose that $x<0$. Because it is all too easy to make errors when handling negative numbers, let $w=-x$. Then $x^2+x+1=w^2-w+1$, and $w$ is positive.
If $w \ge 1$ (that is, if $x\le -1$), then $w^2 \ge w$, so $w^2 -w+1\ge 0$. (Here we used the method that you proposed.)
That method doesn't work when $0, for then $w^2. But $w^2>0$ and $w<1$, so $w^2-w>-1$, and therefore $w^2-w+1>0$.
Another way: Note that $(x-1)(x^2+x+1)=x^3-1$, and that $x-1$ and $x^3-1$ are positive if and only if $x>1$, and are negative if and only if $x<1$.
If $x>1$, then $x-1$ and $x^3-1$ are both positive, so the ratio $\frac{x^3-1}{x-1}$, that is, $x^2+x+1$, is positive.
If $x-1$ and $x^3-1$ are both negative, then again their ratio $x^2+x+1$ is positive.
And finally if $x=1$, then $x^2+x+1$ is positive.
Note that in exactly the same way, we can show that $x^n+x^{n-1}+\cdots +x+1$ is always positive if $n$ is even.