You're getting dinged for a couple of reasons here.
First, you just dumped a bunch of code in your question. To help you, we like to have code, but only the relevant code. And you are asking a very general question that doesn't seem to necessarily be specific to any code...so it's just kind of annoying in this case.
Second, this is a very general question. This is something that you should
google[
^].
With that said, if you really want a program with all of the functionality that you are talking about, you need to use a database not a text file. You are going to want many different tables. One to track products, one to track orders, one to track customers, and on and on... you don't want to be messing with all kinds of text files to do that when a database can handle it so much easier.
If you're not familiar with databases at all,
google[
^] for some tutorials to get started. Then when you're starting to work on it and get stuck, post a more specific question here.
Good luck.