In the past, whenever I felt lonely and hopeless, I jumped into helping others: volunteering, helping an old neighbor garden, help someone move, etc. Helping people gave me a short-term purpose, which eventually let me ride out the low phase of life. YMMV, of course.
This is my go-to strategy as well. When I feel irrepressible bits of loneliness or depression, I just make some food and go out and start handing out to the needy.
Or go for a walk and find people that need a hand. People moving, lifting things, carrying things. Small little acts of being useful and helpful for a moment help.
The feeling will creep back in eventually, but at least for that time I was out and about, it's not.
I have noticed that doing the sign leads to some good conversations in which I've helped someone in a small way, and that gave me a nice little dopamine boost. It's also led to about half a dozen genuine friendships over the past few months. I wonder if that's the answer, a sort of meta-solution: organizing this thing I'm doing into something that other people in the same situation can do, as a way of meeting people and getting outside their comfort zone. Like setting up a chess table in public if chess is your thing. But no, there are already public chess tables, and they'd have already done that. I don't know, just thinking out loud.