Need help and advice

I have been investing in companys that I see seem to be doing well.i check and see if they’re stocks are going up, but as soon as I invest, they seem to just go down hill. I have lost money on every one I’ve invested in. But they were making money for a while so I guess I may be didn’t sell when I should have?
Just need some advice on how to do this better.