screen output

I need to put the following in a script:

echo $CCPDB will give me the db name on the screen. I need to use this name to tar cvfEh <newtarname> <dbname.exp>. I am not sure how to use the output that display on the screen in a script. I tried this

echo $CCPDB > file didn't work

Gundu

tar cvfEh <newtarname> "${CCPDB}.exp"

not sure if that's what you're looking for.