My hard drive is broken on my Mac, I have a new one, but how can I install OS X? I couldn't figure out how to properly explain the issue in my title. 

Here is the deal:
My HDD is broken in my MacBook, every time I boot it up it's freezing. I bought a totally new SSD, but I didn't think before I bought it, so now I am stuck in a bad situation. I cannot download a new OS X, because they are downloaded from the App Store and I can't use my MacBook. I can't use disk utility to format the SSD either, because funnily enough, I also need my MacBook to work to do that. 

So what options do I have here? The HDD is not operational at all, I do have a Windows desktop if I can do something here though. 

Maybe I should also mention my insane stupidity of not having my installation disk either. I have an external harddrive though, so maybe if I could get the OS X iso and get my external Hard drive to install OS on the new SSD. But right now, I'm deep in the water.
You can purchase Snow Leopard from Apple for $19.00US and install it from a optical disk reader. Once Snow Leopard is installed, (it needs to be v.10.6.8,) upgrade to Yosemite through the App Store. Make sure your MacBook is not too new to run Snow Leopard, though.