shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out?

#!/usr/bin/ksh

test="cal > /tmp/tmp.txt 2>&1"
$test

I know it will work for the following format:

#!/usr/bin/ksh

cal > /tmp/tmp.txt 2>&1

However, I need to get the command from the user in my script, so I have to save this command including arguments in a variable.

Thanks

eval $test