You should not be using `exit` inside your `for` loops - this causes the script to exit, and is why you're only getting one result. You should be using `continue`, which will stop the current loop from going on, but will go to the next element in the `for` loop.
Swap both your `exit` statements to `continue` and you should find very different behavior, more in line with what you're looking for.