If you buy a bunch of stocks and the price goes down

and you lose a bunch of money, cant you just wait until it goes up again? so you will earn your money back? or is all your money gone?

The price might never go so far higher that it recovers your money. In fact it might go down even further.

If you have a pretty good strategy you should use it, but holding on in the hope of some good luck coming your way is not that strategy. Just look at the company, the share price and the price chart, and whatever else your strategy says to put under the microscope and look to see, if you were not already holding this share, would your strategy say buy here? If not, get out now.

then how do people invest in long term? long term trades?

There are long-term investments and short-term trades. Each demands a different strategy. The strategy allows you to know in advance what you will do if price in a long position falls.

As I was taught, whatever other precautions you take, it can be a good rule to get out of an investment if price drops 10%. This is because to recover from a 10% position loss back to 100% again, you only need to make 11% profit: however, if you let your loss grow to 50%, then you need to make a 100% profit to get back to your starting position, and there is no known strategy that will reliably do that.

The other precautions of course might include position sizing, diversification of holdings etc. etc.

Long term investment means the stock market - and not particular stocks.

Also investment in increments - if stocks go down then buy more.
10 yrs back s&p hit a low - Oct 14, then again Aug next year, then Feb 16 - see what happened each time - they bought more.

That’s investment - not trading.

Edit: - sometimes a chart says more - monthly - see the wicks to the downside:

what do you mean stock market and not stocks?

If a security that you want to own gets cheaper, buy more. Dollar cost average.

Your tactic will take you for long-term trades. In that case, it’s better for you to trade using low leverage and have a good capital. As the market can go opposite direction as well, you should be mentally prepared to suffer losses as well.