Try using the modulus operator with i to detect every 4th element.
Or increment i by 4 vs by 1 (i++)

I don't understand the rest of your requirements.