want friend but get flirt instead

For context, I’m lonely and have no friends. And I’d like that to change. So, today I was on the train at pretty late hours, driving home. Then a guy started talking to me. As already mentioned, I would like to have friends, so I saw this as an opportunity. Also, I thought that I really needed to improve my conversation skills. So, we made small talk about different stuff. Among others, told him where it been just now, the university I was studying in, what station I lived near to. And then he started telling me he liked my pants and hands, several times, and then I noticed he kept staring at my pants and smiling and then asked for my instagram. And then I got the hint, he didn’t want to just talk, he wanted me in a carnal way. He also talked about how there were not enough women at the dance club he’s just been to.I guess I shouldn’t have talked to him and told him personal information. I’m disappointed, I just want a friend. I’m never talking to another human being again. It cost me so much courage, why is this all I get?