Ideally, you run trade deficits as your economy grows:
Year 1: Internal economy is $100,000. I export $100 in steel. I want to import $110 in cotton. To get the extra $10 I need, I offer the chance to invest in my steel industry, and a foreign investor invests $10.
Year 2: Internal economy is $105,000. I export $110 in steel. I want to import $125 in cotton. To get the extra $25...
When your economy isn't growing:
Year 1: Internal economy is $100,000. I export $100 in steel. I want to import $110 in cotton. To get the extra $10 I need, the government engages in deficit spending, Foreign buyers buy $10 worth of the bonds.
Year 2: Internal economy is $105,000. I export $110 in steel. I want to import $125 in cotton. To get the extra $25...
We're mostly doing the second thing, but the point is that a trade deficit isn't intrinsically bad or good. It depends on why you have one.