He is trying to initialize the audio recorder with different sample rates, from these {44100, 22050, 11025, 8000}.
Depending on the underlying hardware, not all sample rates may be supported by the device.
Although the documentation says:
"44100Hz is currently the only rate that is guaranteed to work on all devices, but other rates such as 22050, 16000, and 11025 may work on some devices."
I think the author has written code to make sure that if initialization at a sample rate fails, an attempt is made to initialize at some other sample rate, unless the initialization is successful, which is given by the check he is making in the loop condition.