This topic may be worth a read:
Mind you, I've looked at your code and it doesn't reference the SD library anywhere. So the fact that you've gotten to the SD card to work at all with no code to enable it/select it/write to it is something of a miracle.