What is this for?
So your code looks OK, beside the i < 4 test.
i < 4
Error output (STDERR) is included in the shell stream.So your code looks OK, beside the i < 4 test.