Writing your own code is fun and frustrating at the same time: when it works it's the one, if you keep getting errors it's the other... Persistence and practice is the main motto here: with persistence you will make every mistake imaginable. But if you learn from your mistakes by practicing often enough (and studying some tutorials and examples), you can soon be on your way to develop your own programs.
Where to start?
As with all beginnings, it starts with a single step. Which, in case of programming, is choosing the language you want to use. All programming languages have a lot of overlap and similar structures. It holds in general that if you master one language, learning another one becomes easier. The choice of the language is mostly dependent on the platform you're working on: some languages are exclusive for one platform, while others can work on multiple platforms.
Depending on the goal of your program, you might also want to use a language that already has a lot of builtin functionality. That way you do not have to start learning the really technical levels of reading individual bytes from a disk or memory. Knowledge of how to do these technical things is important, but may be frustrating to start with.