Right before the while loop you should create a variable in an ‘assign’ and maybe call it notFinished and set it to true. It should be a boolean.
notFinished = true
Now you can use that variable in your condition, so the while loop will continue to go until your ‘notFinished’ variable is set to false.
Then you make an if statement under your element exists where the condition is:
elementExists(which is the boolean value you get from your element exists output)
notFinished = false
then your program will make the ‘Click’ and your notFinished variable will be set to false. Then the if statement will exit and the while loop will check again if the notFinished is true, which it is not, and you will exit the loop and go on in your program.