What hobbies do you have? What do you like doing?
I can't find it now, but at one point I had a list of several things that typically motivate people. Curiosity, authority, connection, receiving admiration from others, etc.
For instance, if I didn't have other things I wanted to do more, I could simply sit in front of a computer and learn new things all day, all week, all month, all year. I would have enjoyed being a perpetual student. Curiosity distracts me from almost everything else.
I do know that if I let myself remain idle for any length of time, my thoughts do tend toward depression. I have to keep my mind, and often hands, engaged in something constructive, curious, thoughtful, etc.
I don't know what you might find interesting. Some people enjoy comics/anime/etc. Movies, reading, etc. these are acts of consumption and feed curiosity.
Others might get into model railroads, programming, web design, construction, etc. acts of creativity and construction can feed a variety of needs. Some people need to show off their works to gain admiration of others, while some merely need to create, the only reward being that they got something out of their head into the real world.
Some thrive on activism and politics. Being able to make a point that is heard, agreed upon,and promoted by others brings a great deal of satisfaction to the person who started it. A modification of this motivation would be arguing, and there are several examples on is forum of people who can argue either side of an issue and find pleasure in being able to fight with others using words, thoughts, etc.
Most people have one or two main motivators, but can derive pleasure and happiness from most of them. Motivation may change throughout ones life, which is why you find some people doing one thing for years, then suddenly realizing they've lost the motivation and love they used to have for it, and have been doing it recently merely because its what they've always done.
Now here's an interesting thing about human nature: the opposite can also happen.
If you start doing something which is now meaningless to you, simply going through the motions, you may develop a love or motivation for it, particularly if you expand on it in directions that tickle your fancy.
I suspect that choosing an activity which can result in many motivations being filled would be good. It may not be the physical activity of track layout that makes you happy about model railroading, but the reactions you get from others when you post your track layout online. Or perusing the many technologies surrounding the hobby. Or being creative and designing and building your own set pieces that are accurate for the obscure town you're recreating. Or working with others online to develop the next generation of track controls, or having a live video feed of your train online that always has a few dozen interested viewers. Or the podcast/blog/video blog that you make discussing your foray into the hobby.
Lastly, one thing that I find that almost always helps (not fixes or erases) for loneliness and depression is serving others. Not only are you helping them, but you're also helping yourself feel useful and wanted, which is something that can be hard to see when you are focusing on your problems and loneliness. You are needed, you can help others. It may seem like a lot of work for no reward, but you might be surprised at how the heartfelt gratitude of others makes you feel, and right now you're really battling with your own feelings.