Ahaha, hello! When I saw your ask, I immediately jumped on it because it's such a fun question! I present to you...
How to Write a Surly (Yet Soft) Character Who ISN'T Annoying
Mean For a Reason + What Makes Them Appear Mean
One thing that is incredibly important when writing characters with a "worse" personality is considering what shaped their personality. Your character should not be rude just because you want them to. Add some background and context to their attitude. Oftentimes, this rudeness serves as a defense mechanism.
Additionally, consider what makes your character appear mean. Do they bully people? Are they inconsiderate of others? Or perhaps do they simply state the truths that people do not want to hear? A "mean" person can look like many things, but not all of them are stereotypical bullies.
Apologies
One of the best ways to showcase character development (in this case, it might be revealing some softness) for a surly character is through apologies.
Having a character who's normally stuck-up, rude, and/or inconsiderate genuinely apologize and realize their wrongdoings is a HUGE moment. It might not cause a monumental shift in the story, but it demonstrates that they feel guilty, responsible, and that they care enough to overcome their pride to apologize.
Awkward, Not Reluctant
A common thing I see when authors write a poor-tempered character apologizing, for example, is that they often seem very reluctant to do so. While the reluctance does make sense because they're doing something they are unfamiliar with, it becomes one of those things that can get annoying when overdone.
So instead of making your character too reluctant to do something nice to someone else, make them more awkward. Reluctance creates a sense that the character doesn't exactly want to be there but is doing it, nonetheless. Although it can seem charming, you don't want your character to appear to be forced to be kind.
However, if you make them more awkward/nervous when apologizing or helping someone, you demonstrate that they WANT to be there, they're genuinely putting effort into trying, despite it still being something that's out of their comfort zone. And honestly? That looks way better.
Avoid The Irrevocable Point
Before I start this, remember that all of these points are my opinion, and this is definitely one of them. If you disagree, that's alright! You're never obligated to listen to everything I say, and many things depend on context!
When writing a poor-tempered character, it's easy to get carried away. Despite that, I suggest being careful about the actions they take. No matter how rude they are, they should not go past a point that's unredeemable for them. Now, this point depends on many factors, but as the author, hopefully you can tell. It's just generally harder to rebuild their reputation as a character and any attempts to do so later on may seem insincere if done incorrectly.
Subtle Actions
Realistically speaking, it's hard for someone to admit something they're uncomfortable with admitting. This applies to your character: verbal forms of kindness are often more difficult for "mean" characters to express.
Thus, I suggest using small, subtle actions to show that they care. It doesn't have to be saving a child from a building on fire or even helping an old grandma cross the road. It can be something like paying for a friend's meal without asking, leaving a bottle of water on an athlete's bench, or just listening to someone.
Pattern of Softness
A surly character is, by definition, not the nicest person, and they are definitely not going to be nice to everyone, ESPECIALLY in the beginning.
What makes your character feel empathetic/sympathetic towards someone? It could be an event someone went through, a few key traits, or their general personality that makes your mean character turn soft. They will not be soft towards everyone, but they might act nicer to those that fall into those specific categories.
It might help to remember that we tend to feel bad towards people who have experienced something similar to us. If it's not something we can't relate to very well, we'll feel less sorrow on the other's behalf.
Don't Make It Forced
When I say "don't make it forced", I mean it in two ways.
For starters, please don't force your character into being extra rude or being nice. You want it to be as natural as possible; remember that you determine your character!
However, I also mean that you should make your character feel forced to be nice. If they wish to correct past mistakes, then yes, there should be solid motivation, but don't force them into feeling like they have to change.
Remember: the key to all this is genuity. An annoying character, no matter their trope, often appears annoying if they lack sincereness.