about how many lines would it take to write your own operating system and what kind of stuff would i need to know to make one
Due to the nature of code, you could fit everything onto one line. But keep in mind, code isn't always about how big it is, but what it can do.
There's probably a tutorial online that you can follow that'll have you make a modification of Linux, but making your own OS is quite a difficult task. You have to have some knowledge on hardware/drivers, and low-level programming in general.