Actually we don't need this line, don't know why I included this in the first place. But the reason I included the password prompt inside while loop is to make the user re-enter both the passwords again if he gets it wrong.
Suppose the passwords do not match, the user may have entered the actual password itself wrong by mistake and not realize it. It's not necessary that he always enters confirmation password wrong. 

Thats what I thought. What do you think ? Other than this, did I break anything ?