You're going to have all sorts of feelings when faced with a situation you don't have much control over. And you can't control when your emotions show up or what emotions they are. BUT you can always control what you DO about your emotions. And you can control your expectations too.
You have all kinds of expectations about what things SHOULD be like. Your grandma SHOULD be healthy and enjoying her old age. When you do nice things for her she SHOULD recognize them. She SHOULD not isolate herself from her family.
That's a story that your mind is telling you, though. And it's a false story because THAT IS NOT THE WAY THINGS ARE. You are not really accepting the reality of the situation you are dealing with, and that is probably what's causing the anger. Then you aren't accepting your anger and that is causing you more mental suffering and then you choose your actions badly.
Now... it's not going to be easy to accept an unpleasant reality. Nobody wants to deal with unpleasant feelings and situations and think about unpleasant facts. But reality doesn't get any better just because you struggle against it. In fact it tends to get worse because then you have to deal with the guilt of talking harshly to your grandma, and maybe she gets upset and things suck even more. So you're going to have to practice stepping back from what's going on in your head and your life and think about what's actually happening. Describe things factually. "I am angry right now." "Grandma doesn't remember what I just told her." "This is the way things are. It's not fair and I don't have to like it, but that's how it is."
When you can feel yourself getting frustrated you can take a few deep, slow breaths and take a short bit of time to decide what to do. Maybe go to the bathroom or get a drink of water. Maybe you need someone else to take over for a little bit while you go for a walk. Then think about what it is that you would like to do, how you would ideally act if you weren't angry or frustrated at the moment. Because you can't always help how you're feeling, but that doesn't mean that you have to let your emotions control your actions. And ideally you would probably like to speak kindly to your grandma -- and you can, even if you aren't feeling particularly calm or kind inside.
You might find that you want to let your feelings out at some points, though, and that's not bad. But you can choose how to do that and when to do that. It's probably not very helpful to snap at your grandma but it might be helpful to talk it over with a close friend, or to write in a journal, or to post here. You don't need to keep things bottled up but like... obviously people don't act on every urge that passes through their heads or else everyone would be punching people who made them angry or stealing stuff that they wanted really badly or harassing people they found attractive. We don't act on MOST of the emotions we have so it's not impossible or anything. It's not always easy, sometimes the urge to do something is overwhelming, but for the most part we manage pretty well.
You'll probably screw up sometimes because you're only human and we all make mistakes. When it happens accept it, forgive yourself and try to do better next time. We can't be perfect, all we can really do is work on improving.
Make sure you’re not taking too much on yourself and that you’re not bottling up frustration. It is extremely taxing to take care of a person in your grandma’s condition.
Rant, vent, and don’t feel bad about it. If you have other family members that can’t help for distance or time reasons lean on them for emotional support. Let them know that’s how they can do their part in helping.
Dealing with (age) demented person can be very difficult. I have no idea how to deal with such sort of anger ... but I can feel with you. My mother was in a care home for some years, and half ot the demented people there creeped me out. Some where nice and thankful for the help they could get though.
I'd say, accept it and try to be incredibly patient. These people don't mean it bad. They just can't remember things, sometimes not even think clearly anymore. Brace yourself that you'll have to repeat things countless times, day by day. Besides of being stoic and still helpful, little to do I guess.
that we feel powerless about...
That was a really hard lesson that I had to learn too. Sometimes we are really just a sandgrain in a big desert.