What to do when mechanic doesn't fix problem, twice?

Ok, I know NOTHING about cars.
I have a manual 1991 Honda Accord. I had a code 17, and 12. The EGR and speedometer. It also needs to be smogged.
It had trouble starting. I had a friend put in a new battery for free.
So I drive it to smog shop and it dies right as I get there. The smog guy removes a big tube and sprays stuff into it which causes my car to somewhat try to start and he tells me he thinks it might be the fuel pump. So I take it to a mechanic and tell him the symptoms. I get it back a couple days later and he tells me he replaced the fuel pump and filter. COOL. I try to drive to the smog shop again. My car begins surging like never before then continuously dying. UGH,
Back to the mechanic. He fixes the wonky speedometer and something else I can't remember (someone else has the paperwork currently) I get my car back a couple days later. Starts and runs like a dream! I drive to the smog shop again, and the guy loads it onto the dinosaur. As it begins the test. It dies. It will not start again until it has cooled down.
I try driving home, but it dies halfway and I pull off to the side. I wait, start it again and drive it the short distance home all while it's yearning to die, the stick is now giving me difficulty shifting and I smell burning. What the heck? What do I do? I never thought I'd take my car to a mechanic Twice and still get it back dying! I feel like he didn't do a full check, just took my word on the fuel pump and symptoms, help! I need it for school!

Added (1). PS: If it wasn't the fuel pump, wouldn't he have taken it out and noticed nothing was wrong with it and put it back, rather than charging me for the parts and labor of a new one? ($287 by the way) I've been watching youtube videos of guys doing this. Why replace it if it's not broken, and not the problem?

Added (2). I did not tell him to fix anything specific because as I said, i know nothing about cars, i simply gave him a list of the symptoms i experienced while driving the car. I did not tell him to replace the fuel pump, i just brought it in to be fixed for whatever the reason it was dying was. Which was not fixed as it is still dying… Sooo?

He fixed what you wanted fixed. Next time, he will fix what you want him to fix.

Sounds like your fuel tank vent is blocked thus a vacuum creates in the tank preventing fuel flow. This goes away after a short time, that is why the car will start after a short while.

If you had told the mechanic what was happening instead of saying "I want the fuel pump replaced", then you would not have this problem now.

Have one of your clowns put a main relay in it. Google: "Honda main relay" to learn why.