The while loop with true condition is just to ensure this process can enter and exit its critical section repeatedly. This usage is quite common when we are discussing concurrency programming.
Take a moment to reflect. How can you create an environment to demonstrate easily the effect of two or more different concurrent processes are, for example, contending for one shared resources? If you let each process just try to enter the critical section once, it might be hard to produce the various particular situations that could happen only to concurrent running processes. It may just happen all processes enter the critical section in order once and then exit. However, if we use a while(true) loop to run the processes long enough, it will be much more probable to observe all sorts of phenomenons.