P.S. I was using two do while loops one inside of another maybe that is what caused it?
It could well be. A break
(note the spelling) will only break out of one loop, so if it was inside the inner loop, it would break out of that loop, but continue execution immediately after the end of the inner loop. In the (fairly common) case of the outer loop ending immediately after the inner, you’d end up executing the condition of the outer loop again.
solved Why a do while loop excecutes after brake? [closed]