How to Store data in SD card?

I have tried writing data on SD card with my micro SD card but the card fails to initialize. How can I store data on SD card with arduino uno? Is there any way to directly write the data from arduino to .txt file?

What have you tried?

Where is your code?

Please read this