Saving an unsigned long int to internal EEPROM

GautamD:
For what should I build functions outside the loop so that debugging becomes easier?

I mean what part from my code should I try to build outside the loop?

Thanks for the help till now.