Just like you don't learn how to build bridges just by drawing them, you don't learn to program just by writing a program. You need to build it, and you need to have a way to discover the cause of its flaws when it inevitably fails. It is integral to how you learn from your mistakes.
Basic debugging is not an optional, or an advanced technique. It is what every programmer should do, right from day one.