When you know in advance, or can calculate in advance, how many times the loop should run, it's more normal to use a for-loop. When you don't know how many times, a while-loop is more usual. To be honest, using do-while loops is quite rare, I can't remember last time I used one.
To do what you want now, the code will need to change quite a lot. You will need to use both for-loops and while-loops. You know how many presses you want, so use a for-loop for that. What you don't know is how long it will be before the button is pressed, or how long it will be pressed for, for each of the 3 presses. So use while-loops for that.
You will also face, maybe for the first time, the problem of buttons bouncing. If you don't know about buttons bouncing, it's like dropping a tennis ball onto a hard surface. It takes several bounces before the ball stops moving. Inside a button, you have two contacts held apart by a spring. When your finger pushes the button, the contacts close, but bounce apart again, then close again, and bounce again several times before they settle. You don't want those bounces to count as your 3 presses. The tennis ball will take several seconds to settle, but the button will only take a few hundredths of a second. So you can ignore those switch bounces by using, say, delay(20). By the time this 20ms have passed, the switch should have settled.