You can't overtake so you have to stop acting on the throttle and lose 20mph with the engine brake alone waiting for an opening. When it's clear, you accelerate a lot to get back to cruise speed; then repeat the situation several times. Why is it inefficient?
Presumably this occurred at highway speeds, where hurry up and slow down is very inefficient. This hurry up and slow down driving can be amazingly fuel efficient at slower speeds. One alternates between accelerating (at some optimal value) and then coasting. The fuel injection system shuts down fuel flow during the coast phase. Another name for this is pulse-and-glide.
The reason hurry up and slow down is inefficient at highway speeds is because your vehicle is already operating beyond it's peak efficiency. Internal combustion cars and light trucks experience their best mileage somewhere between 35 and 55 mph (55 and 90 kph), depending on the vehicle. The lower end is where trucks and SUVs operate; the upper end is high end sports cars. Unless you're stuck in a traffic jam, your freeway speed is faster than your optimal speed.
Accelerating to pass does a number of things to reduce fuel efficiency at these speeds. Drag grows quadratically with velocity, so even a small change in velocity increases drag considerably at highway speeds. Your car doesn't have much oomph at highway speeds if you don't downshift, which makes acceleration rather expensive fuel-wise. If you do downshift, that throws your car into a regime where torque falls with increased engine speed. Your car now accelerates nicely, but at the expense of seeing the fuel needle move.
So how does hurry up and stop ("pulse and coast") work at slow speeds? Internal combustion engines are rather inefficient with regard to producing torque at low engine speeds. Fuel efficiency suffers as a result. A typical car is considerably more fuel efficient when operated at 45 mph as opposed to 30. Suppose you accelerate optimally from 30 mph to 40, then let off the gas completely and coast back down to 30, from which point the cycle starts anew. The increased speed will cost a bit in terms of increased drag, but drag isn't nearly as strong a force at 40 as it is at 60. You'll more than make up for that drag loss with improved engine performance experienced while accelerating to 40, and your car consumes no gas during the coast phase.
There is one minor problem with this pulse and coast technique. Other drivers do not appreciate it at all.