Problems with using grep to make backups to a different directory

I am trying to program a script that is using grep to find lines in a file in my home directory, and then use a pipe command to copy what is shown into different files in a different directory to create backup files. When I run it, though, it only creates a copy of the file that grep was going through, not the actual lines it found in that file. Here is a sample of the code:

 if (-e $argv[1]) then
   if (-d $argv[2] then
    grep '.*' $argv[1] | cp $argv[1] ~/$argv[2]/$argv[1].bak
   endif
endif
exit 0

The first argument is the file you want to use grep on, and the second argument is the directory I want the backup to be put to, with the same filename with a .bak at the end. Any ideas on what I'm doing wrong and why it isn't copying the whole thing? Thank you

grep '.*' $argv[1] > ~/$argv[2]/$argv[1].bak

My problem is that at the end even if I use the redirection operator,

 >  ~/argv[2]/$argv[1].bak

I'm thinking it is only taking the file that I am using grep on, and not the actual stuff listed by grep. What would I have to put besides $argv[1] to make the lines different files in the other directory instead of one renamed file that grep was just used on?

Thank you for your suggestion.

Did you give it a try? Here's an example:

[user@host ~]$ cat file
hello
world
hellomars
[user@host ~]$ grep hello file > ./test/file.bak
[user@host ~]$ cat test/file.bak
hello
hellomars
[user@host ~]$

I am wanting each of the things listed to go into different files, though, and not just one file in the other directory. For example after I do the backup files when i do an

 ls ~/test

i would get back a hello.bak and a hellomars.bak

If you make the file contents the new filenames, what should be the new file contents?

The file contents would be the scripts that are in the file names

Your requirements are stated in a very confusing way and I see absolutely no need use grep. I don't write code using csh, but I think the following Korn shell script will do what you want. (It should also work with bash or any other shell that recognizes basic POSIX shell syntax.)

#!/bin/ksh
ec=0
IAm=${0##*/}
if [ $# -ne 2 ]
then    printf "Usage:\t%s list_file dest_dir\n" "$IAm" >&2
        printf "\t\$HOME/dest_dir must be an existing directory\n" >&2
        exit 1
fi
if [ ! -f "$1" ]
then    printf "%s: \"%s\" is not a regular file\n" "$IAm" "$1" >&2
        exit 2
fi
if [ ! -d ~/"$2" ]
then    printf "%s: \"%s\" is not a directory\n" "$IAm" ~/"$2" >&2
        exit 3
fi
while read -r file
do      if ! cp "$file" ~/"$2/$file.bak"
        then    ec=4
        fi
done < "$1"
exit $ec