To solve a problem it is nice to know what the problem is.
You have made very clear what you want to happen, but not what is happening.
So the question remains, when your program is running, what is the text showing?
I understand it's not showing what you want it to show, but to know where the problem is, it is necessary to know what the problem is exactly.