running the quantum light program in while loop