He's a manipulative bastard, and he got you hard, I know you don't want to hear this, but you came here, and you came here not because you're happy.
I don't mean to judge, but before him, did you feel really bad, and really wanted to feel loved and happy in a relationship?
Trust me, it's not that he's no good, but you need to throw him out of your life, learn to accept yourself and start loving yourself, only then, you will be able to find a guy, who will make you even happier.
P.S. He's drawing you in with gifts and warmth and all those little things, and whenever you make a mistake, he punishes so you would go crawling to him, it's a really common manipulative move "lure in and withdraw" . I know it hurts , you feel like nothing, lonely. This happens, but do not doubt yourself, just try to make your life better, and start, by losing the chain he put around you.
P.P.S. Quick suggestion, do the same as he does to you, act like you do now, whenever he acts all cold, tell him, if that's how you're going to treat me, I don't need you, and don't write to him at all. This may give you a satisfaction because he might come crawling to you, begging to get back into your life, or he might not do that , and you're free, because you don't speak anymore!