9 times out of 10, if someone accuses you of being ungrateful, it has nothing to do with you showing gratitude wrong and everything to do with them never wanting to help in the first place.
More often than not, "you're ungrateful," is literally just code for one of these:
"I did something for you because I felt obligated to and I now blame you for my past inability to set my own boundaries."
"I did something for you and expected you to do something of equal value for me immediately after, without ever stating that expectation, and you didn't hold up your end of the deal I decided we made."
"I did something for you because I felt morally obligated to and, because the entire situation you're in that caused me to feel that way wasn't immediately resolved by my act of charity, I've decided that you're actually doing this on purpose to extort people's time, energy, and resources."
"I did something for you because I'm a good person and you didn't adequately sing my praises and boost my ego to everyone we know, which is what any normal person would do if they were gifted with my invaluable services."
"I did something for you and expected you to do things for me in return, but your lower class and lack of resources means you have nothing of value to offer me in return, so you're therefore unable to pay your debts for my services, regardless of if you've wasted your time doing things for me that I deem worthless."
"I did something for you and expected this to mean undying loyalty and subservience, but you've dared to disagree with something I said, refuse one of my demands, or treat me as an equal when you needing my help made me superior."
So basically, if someone calls you ungrateful when you've actually put in an effort to show gratitude (like saying Thank You, expressing appreciation, etc.), they were never looking for gratitude to begin with. They're simply using gratitude as a way of making their sour feelings your fault when what they're actually upset about is that their attempt at insincere help didn't gain them anything.
In simpler terms: they're selfish.
People who genuinely care and genuinely want to help don't do so expecting something in return.
If someone wants something in return, they should state that right away, making the entire thing transactional and not an act of help, charity, or assistance.
The same goes for people who say you took advantage of them when you only accepted what was offered.
It is your responsibility, when you offer something (time, energy, money, resources), to make sure that what you're offering is something you actually want to share out of the goodness of your heart.
If you don't put down any boundaries regarding your offered help or resources, it is not the fault of the person you offered them to for not determining your boundaries for you.