Not sure whether you have to do it this way for an assignment for your school, otherwise I would use an existing bootloader like GRUB if you want to write an operating system - when you start with the bootloader, there's a big risk that you give up before you even started on the actual work

.