Could someone help me with password protecting zip file using 'zip -e' command

I have the following code where I'm trying to zip and set the password
zip -e $PCDDATA_PATH/$datafilezip $PCDDATA_PATH/$datafile
expect {
"password" {
send "test\r"
}

}
expect{
"erify" {
send "test\r"
}
}
but for some reason this doesn't work.

Does anybody has a script which I can use for this purpose, or fix the one above.

Thanks in advance.