I'd like to help, but I just don't understand.
1. You click the button & TEST is found
2. If it is found, you don't want the search function active any longer? If not, disable the button.

Maybe you can tell us in different words when the search function should be disabled and when it should not be disabled.
The search function you have exits when a match is found, it does not keep looping.