I finally saved up enough money and bought a new Yamaha P125 digital piano, and I made the error of plugging the sustain pedal jack into one of the AUX outputs and switched the piano on as I couldn't see the labels from the angle I was looking. Now I am concerned that this could have damaged my piano even though it is functioning properly as of now. Should I be worried that I might have somehow damaged my digital piano ?
No, it shouldn't hurt. The worst thing that could have happened was shortening the AUX output terminals. The voltage on audio outputs is low (or zero if no sound was playing), and at the same time the output resistance in typical audio equipment is perfectly sufficient to limit the resulting current below what could damage anything in the piano.
Making similar "mistake" with a power amplifier output could potentially damage something, but with line-level outputs there is no reason to worry.
Very doubtful it's done any harm. It's not even shorting anything out until it's pressed down - that's how it works. To make sure in your own mind, plug something into that aux out, which can go to an amp etc., and will most likely work fine still.
It's when you plug a figure of eight mains plug into an XLR socket that sparks fly. I know, been there, done that, got a hefty bill ! As you found out, make certain you can see the ports properly before any plugs get inserted !
Can you perform an experiment to test? Plug in some kind of equipment (amplifier, effect, recording equipment) and see if the output is functioning as normal. That should put your mind at ease.
If you don't have anything suitable to test with, I would still probably assume that a quality product from a reputable manufacturer like Yamaha will include short-circuit protection on line-level outputs so that the pedal wouldn't cause damage even if you depressed the pedal while it was plugged in.