If you check your other thread I've already told you what the problem is. For the sake of argument, I'll repeat myself.
Calling getline is overwriting your text variable with each loop. Therefore, when you press enter twice, text contains the character '32' (Which represents Enter)
When you get your data into text, you need to store it somewhere that it won't be overwritten.