The most important things is, whatever you say, it needs to come across naturally. It's not as important what you say but rather how. Don't get stuck trying to figure out "the best" thing to say. There is no such thing. The words themselves don't particularly matter. Communication is mostly non-verbal. Trying to memorize lines doesn't make much sense then now does it?
When what you're saying is actually part of your personality it will resonate much better. It's hard to lack confidence or say the wrong thing when you are being yourself. When someone is forcing it or pretending, you can usually immediately tell and that's when it becomes awkward.
You can use ideas of things to say from other people and build from that, but ultimately it comes down to lots and lots of practice, learning your own style, and getting over the anxiety of socializing with strangers. How about this. Next time you see a cute girl, go up to her and literally talk about the topic of this thread.
"Hey" ... "It's kind of hard to think of things to say sometimes (smile)" ... "I get all up in my head and stuff" ... "It's like if you try too hard to do something simple, suddenly it becomes hard you know haha" ... from here there's over a million ways the conversation could go, and a lot of it depends on variables like where you are, what the person says, how the person is reacting, etc. So don't like try to memorize series of things to say. You have to be flexible.
If the girl was interested in talking, she would probably reciprocate and make it easy for you. If the girl is acting cold politely but promptly excuse yourself. For example, "Well it was nice talking, see you around." The hardest part of talking to a random person, is opening them up... because once they reciprocate, it becomes much easier as you can then respond to any interesting things they say and the conversation builds on itself.