As long as you have more money coming in than your costs, then it's technically a profit even if that money comes from investments.

It's not the same as debt from a loan, because people are buying a percentage stake in the company. If the value of the company happens to go to zero there's nothing left to pay.

But yeah, the amount of investment a company attracts should have something to do with the perception that it'll operate at a profit at some point