I think you shouldn’t use Firebase calls in a loop because as it connects to internet, it will have some delay, and it will cause a lot of Got Value event fired at the once. You shouldn’t call another task before previous task finishes.
Calls to Firebase are performed asynchronously, meaning the loop will send fetch calls for all values in the list without waiting for a result. The GotTag event is called independently for each value as and when the request is resolved. The break block won’t work here because the program’s control never gets to the “then” part. The variable you’re testing is not guaranteed to be true while the loop is being run.
I suggest you edit your blocks such that the program waits till all values are fetched from Firebase