Given a Turing Machine M and a string $x$ how do we tell whether a the Turing Machine M loops on the string $x$ Let us say there is a Turing Machine $M$ and a string $x$.  So now I want to know if $M$ accepts or rejects the string or loops on it. So, I feed the string to $M$. So, if $M$ is accept or reject the string it would halt after a finite time and I would get my answer.  But how do I know if the machine loops on the string or not.

One possible way is to see if a configuration repeats itself. However, the machine has no way of knowing  if the configuration has occurred before because it cannot store them . So, we would never get an answer. So, how will I be able to tell whether or not $x$ is accpted or rejected or looped upon by $M$.
Halting problem is generally unsolvable. The states don't have to repeat. But if you know that they will, see cycle detection.