I want to construct a graph $G$ such that $G$ does not contain $K_r$ but $G$ is not $(r − 1)$-partite for each $r \geq 3$. ($|G|$ is not fixed)
I think should be a start with a path but a path is bipartite. Can someone give me some idea to construct it?
Not being $(r-1)$-partite is equivalent to having chromatic number at least $r$. So we want to find a graph $G$ with $\chi(G) \ge r$, but not for the "trivial reason" of containing a $K_r$.
The simplest such graph is the $5$-cycle $C_5$. This does not contain $K_3$ (a triangle) but $\chi(C_5) = 3$.
From here, we want to increase the chromatic number without creating big cliques. We can go up to $r=4$ by adding a vertex adjacent to all the existing ones, creating the wheel graph $W_6$:
This does not contain $K_4$, but $\chi(W_6) = 4$.
We can generalize this approach, for one way to solve the problem.
In fact, almost any graph will work - literally. If you take a random graph on the vertices $v_1, v_2, \dots, v_n$, the largest clique it will contain, almost always, will have about $2 \log_2 n$ vertices. However, the chromatic number is much larger than this: by the same token, the largest independent set will have about $2 \log_2 n$ vertices, which means at most that many vertices can have any color, and therefore the chromatic number will be at least $\approx \frac{n}{2 \log_2 n}$.