Script to concatenate several files

I need a script to concatenate several files in one step, I have 3 header files say file.S, file.X and file.R, I need to concatenate these 3 header files to data files, say file1.S, file1.R, file1.X so that the header file "file.S" will be concatenated to all data files with .S extentions and so on for "file.X" and file.R with the .X and .R data files..
I tried using wild cards, like:

cat file.S file[1-50].S > file[1-50].SP

but I got a message saying that file[1-50].SP does not match
so can this be done through a script? this will save a LOT of time for me, so if someone can help me it will be much appreciated

If I understand your question this should work (not tested!):

for letter in S R X
do
  for i in file[0-9].$letter
  do
    cat file.$letter > "$i"P
    cat "$i" >> "$i"P
  done
done

Regards

thank you,
can you please explain to me each line?
for letter X R S
is a loop, that begins with X, then R then S, so letter is a variable, it can be substituted by i or x right?
then what does the line before done do?

These are basic shell loops, you should read some books or tutorials about scripting. To learn scripting is to read about it and try to find things out yourself.
Echo the variables within the loop like:

for letter in S R X
do
  for i in file[0-9].$letter
  do
    echo file
    echo $letter
    echo file.$letter
    echo "$i"P
    echo "$i"
  done
done

Change the names of the variables and watch what happens and so forth.

Here you can read something about loops and variables (Googled on 'ksh scripting tutorial'):

KSH script BASICS

Regards