To clarify further, I think loneliness is wholly a sin no matter how you dice it up, because it dishonors God. To say you are lonely dishonors God, because God "is everywhere present and fills all things, treasury of blessings and Giver of life." He is all Good. To wallow in loneliness and despair is to not recognize God's presence and is to deny hope in Him. Loneliness is blasphemy.
Look to the hermits. A hermit is never alone truly, because he is in the presence of God. A good hermit is never lonely and never despairs. So if you despair in loneliness, know it is sin that makes you feel this way. God does not desire us to be lonely. He created the whole universe as a sign that we are not alone. Yet, if you feel lonely, this is an affect of the fall.
"And the Lord God said, It is not good that the man should be alone; I will make him a help meet for him. And out of the ground the Lord God formed every beast of the field, and every fowl of the air; and brought them unto Adam to see what he would call them: and whatsoever Adam called every living creature, that was the name thereof" (Gen 2:18-19).
I know it is hard to swallow this pill in your isolated and dark feelings, but really this should bring you hope that God is there to lift you up and love you.
To forgive is a giving action. I give you something, and that is my love and pardon from transgression. When God pardons us, He also gives us something. His love. We are to do the same.
Out of the depths I have cried to You, O Lord.
Lord, hear my voice!
Let Your ears be attentive
To the voice of my supplications.
If You, Lord, should mark iniquities,
O Lord, who could stand?
But there is forgiveness with You,
That You may be feared.
I wait for the Lord, my soul does wait,
And in His word do I hope.
My soul waits for the Lord
More than the watchmen for the morning;
Indeed, more than the watchmen for the morning.
O Israel, hope in the Lord;
For with the Lord there is lovingkindness,
And with Him is abundant redemption.
And He will redeem Israel
From all his iniquities.