Problem with Shell Scripts deleting text in files.

Me and a friend are working on a project, and We have to create a script that can go into a file, and replace all occurances of a certain expression/word/letter with another using Sed. It is designed to go through multiple tests replacing all these occurances, and we don't know what they will be so we have to anticipate anything. We are having trouble on a certain test where we need to replace 'l*' with 'L' in different files using a loop. The code that i have is

#!/bin/sh
 p1="$1" #first parameter

shift

 p2="$1"

shift

for file in "$@" #for any file in the directory

do
   # A="$1"

    #echo $A
    #B="$2"
    echo "$p1" | sed -e 's/\([*.[^$]\)/\\\1/g' > temporary #treat all special characters as plain text
A="`cat 'temporary'`"
rm temporary
echo "$p1"
echo "$file"
sed "s/$p1/$p2/g" "$file" > myFile.txt.updated #replace occurances 
mv myFile.txt.updated "$file"
cat "$file"
done

I have tried testing this on practice files that contain different words and also 'l*' But whenever i test it, it deletes all the text in the file. Can someone help me with this,

Hrm. What's $A created for if you don't use it? When I run this script:

mute@flo-rida:~/temp/Johnny2518$ cat input
Hello World!
mute@flo-rida:~/temp/Johnny2518$ ./script '|*' L input
|*
input
LHLeLlLlLoL LWLoLrLlLdL!L

What do you see when you run it? As you see the results are not as expected, but the file is certainly not empty. Show your output please?