You've created a dangerous situation. If your system is properly grounded, you likely now have current traveling across all sorts of fun things, like your gas and water pipes. If a gap develops in the grounding path, your timer might stop working till someone accidentally completes the circuit and shocks the heck out of themselves at the same time.
Disconnect the timer ASAP and wire the old switch back in. While you're at it, relabel the white wire with a bit of electrical tape or a Sharpie. Use any color other than white, gray, or green.
What you have is a switch loop. The hot loops out from the fixture, through the switch, and then comes back to the fixture to connect to neutral. A smart switch like your timer needs to use power, not just interrupt it, so it needs a neutral of its own. You need to get it that neutral; one way would be to replace the 2-wire cable coming from the existing fixture with a 3-wire cable. The fixture neutral and new cable neutral would be spliced together with the existing neutral in the fixture box. The timer switch would still be used to interrupt the path to the fixture, but it would figure out when to do so by relying on its on power.