Trade surpluses and deficits have plenty to do with external debt. I'm probably wrong that they alone determine external debt. Japan always runs trade surpluses. How do you account for Japan's 1.6 trillion external debt?? (CIA)
The Japanese government borrowed and spent more money than they took in. They did this even though private Japanese companies and citizens sold more goods to the rest of the world than they bought from the rest of the world.
Got it?