I thought that "break" exits the for loop at what ever value "i" was at, at that time. I could be wrong.
The way I was going to write the sd log part of this code was to use xxx.close. In the main loop I would open and close the file for every iteration. Would this be a good idea?