Hello!
You need to make 2 parts:
1. An SD card driver. This allows you to write raw data anywhere on your card.
2. Once you managed to develop an SD card driver, you need a FAT file system
(I suppose that you are going to use FAT format to write your SD card with a PC and
read it with you MCU, right?
There is plenty of documentation on the net about this subject. Basically once
you know how SPI works, then you can port any SD driver, and based on that
you can port any existing FAT. Writing the FAT yourself is quite a lot of work
to reach something stable. But that's a very good programming exercise.
Dora.