And note - you do not use "while" loops in any program that requires multi-tasking - doing more than one thing at a time. And "delay()" is itself, a while loop, so you cannot use that.
All this said, the problem with your program is simply that it is disorganised and you have not thought it out properly.
Please read the instructions for posting here.