See if something like this will work for your needs:
Code:
#!/bin/bash
cat output.txt | grep cpanel | while read file
do
dir=`dirname "$file"`
scp "$file" root@second_server:"$dir"
done
Note: I placed $file and $dir in double-quotes in case either has a white-space in their respective file name.