Companies are not human beings. They do not have hopes and dreams, feelings or aspirations. They cannot really be helped or hurt because that would require some objective measure of "goodness" for a company. And if you try to construct such a measure, you will rapidly get tangled in contradictions.
Companies exist to benefit their owners. Companies are structures humans create to provide particular benefits to particular human beings. It is really only meaningful to talk about something hurting or helping a company in terms of whether it provides the benefits the company was created to provide.
Say my car breaks down. It doesn't help my car to fix it. My car doesn't care whether it works or doesn't and isn't, in any sense, better off if it's fixed. But I own a car to get around. And if my car doesn't help me get around, that's a meaningful way in which the car is "worse". And something that helps the car help me get around in a meaningful way helps the car.
When you buy shares of a company, you push the share price up. The helps the company's stockholders get more benefit from their ownership in the company. And that is the company's purpose.
So just like fixing a broken car helps the car in the sense that it makes the car help the owner more and that's the car's purpose, buying shares of a company makes the company help its owners maore and that's the company's purpose.