The error gets resolved when I use OP_10 instead of 030a0000 to push the number 10 on the stack.
It appears that the bitcoin optimizes the size of the scripts. So to push any number from 2 to 16, OP_2 - OP_16 should be used and for numbers greater than 16 we should give minimum required bytes in the script.
OP_10 (5a) -> Correct
01 0a -> non-...