You poor thing. I am so sorry to hear about all the hurt and pain you've had in your life. I hope that things begin to turn around for you.
In answer to your question, God does not make bad things happen. God is not mad at you; in fact he loves you more than you can even begin to imagine. God doesn't test us by making bad things occur, especially at such a severe level. He's not trying to teach you a lesson in anything. The enemy (Satan) comes to steal, kill, and destroy.
Also, your works are not what gains favor with God. You can go to church every day of the week, pray before every meal, and go to confession all you want, but if you do not have a personal relationship with God, it does you no good.
It is normal to have doubts when things don't look cheery and bright, but during this hard time, don't turn your back on God because He has not turned his back on you. The enemy would want nothing more than to cause you to doubt at this time. Instead, turn and run into God's arms and bask in the love and comfort you will find in His presence. Talk to Him, just like you would talk to a friend. He is there to listen. And when you are done talking, sit quietly, and listen for that still small voice inside you. That is how He talks to you.