Be confident when interacting with others, even without saying a lot. To develop a sense of self-confidence, you can work hard and do something well to give yourself a sense of accomplishment, and your self-confidence will slowly increase. If you are confident, others will care about interacting with you.
Sometimes you don’t have to care too much about what others think. You have your own ideas, your own opinions, your own way, and let others speak.
If you feel lonely, go outside and see other people's lives. You can go to a clean park, go hiking, or walk on both sides of the street. Look at the people and things along the way, the people with different looks coming towards you. It turns out that life has a lot of fun. When you see certain things, you will find that I am very happy compared to some people. At this time, your heart may suddenly become enlightened instead of lonely.
I recommend you to read a book called "Meeting the Unknown Self" by Zhang Defen. I benefited a lot after reading it, and I hope it will be helpful to you too.