Even the best of Christians suffer from loneliness in their singleness. Know that contentment in singleness is important for contentment in marriage. You cannot think that marriage will make an uncontented person, content. That just does not happen.
What is helpful is to look at Joseph’s life (Joseph the son of Jacob), who was sold to the Egyptians at a tender age of 17. It is to be noted that he was single until God showed him His purpose and subsequently its blessings. Did Joseph presumptiously take the temptations before him as a way to escape his loneliness? No, for he knew that his loneliness was brought about by God. God was purposing everything (the successes and failures) in his life for His purpose. And the result of holding on to the hope in God is blessings that he could not have foreseen; family, reunification, salvation for Israel, fore shadowing of the Christ.
When you are lonely, look to Joseph and see the grace of God in patience and trust.