Binary File Handling Sucks.. Need help

I am currently trying to make a database type program where I keep the details of a Sweet Shop…

I used file handling as I wanted some challenge and I don’t know MySQL connectivity… This part of the code is giving me problem as it doesn’t dump data into my *.dat file. Line 20 of the same module does save the data so i know there isn’t an error with my file but i cant figure out how do I make the data get saved.

Would be glad if someone helped… <3

(P.S: Open for the code to start, also I dont know if you can see the enitre repository if i link just 1 line so posting the link for the repository too.)

A free service run by Zed A. Shaw for