It looks as though you have found some sort of skeleton program for echoing a statement from a server back to a client.
However, I don't see any attempt to actually solve the problem you have presented.
Furthermore, your specifications which you have provided us are quite ambiguous which does not allow me to definitively decide how I could help you.
Does everything need to be stored in a file (and updated in said file). Or can you have a Inventory class which keeps track of everything and writes to the file when all transactions are done.
If you have an Inventory class you can simply serialize it at and send it to the client to use initially. You should then be able to update it from the client and relay those updates to the server.