Clarification about redirecting

Hi AM Using Unix Aix
Used
${CMD} 2> ${ERR}
Dont get what above statement works .

 
SCRIPT=`basename $0`
ERR=$PWD/$SCRIPT.err
DATE=`date +"%d/%m/%Y"`
CMD=2
${CMD} 2> ${ERR}
if [ $? -eq 0 ]
then
echo "SUCCESS"
else
echo "FAILURE"
fi
 

Am getting the output as Failure. Can anyone tell me how does Redirections working in the script.
Tanks in advance..

I think in CMD you trying to have some valid unix command? 2 will give command not found..

and 2> will redirect standard error output to a file.