I mean what part from my code should I try to build outside the loop?
You want the user to enter a number, that you call count. So, create a function:
unsigned long count = getCount();
You want to save that value in EEPROM. So, create a function:
saveInEEPROM(count, address);
You want to show the user the value stored in EEPROM when the Arduino starts up, so you need to read that value. Create a function:
unsigned long storedCount = readFromEEPROM(address);
Then, when you have a problem, it is easy for you to discuss which function you need help writing/debugging/calling. It is easy to look at a few lines of code that purport to save an unsigned long in EEPROM by looking at the function saveInEEPROM() vs. having the find the 10 lines of code in the 12000 line loop() function that are supposed to do that.