Inserting data from another source

Hi, I am creating a script using Vi to go out on emails. Each email has is own set of attachments, each with a unique number eg Q12343 and Q67897. I have managed to get the script to put in the first attachment customer number ie Q12343, but can't figure out how to get the second one to come in ie Q67897 from the next attachment.
This is the code I have used:

<td>�</td>
<td align='right'><b>Account:��</b></td>
<td align='left' colspan='2'>$$CUSTNO</td>

The html that you have shown us is the output. What does the input look like.
My first guess would be that you need something like:

echo "<table>"
while read CUSTNO
#or maybe
for CUSTNO in $list
do
echo "<tr>"
echo "<td>�</td>"
echo "<td align='right'><b>Account:��</b></td>"
echo "<td align='left' colspan='2'>$$CUSTNO</td>"
echo "</tr>"
done

echo "</table>"

Thanks for your reply, as you probably guess, I'm a total novice at this. Not sure what you mean by my "input". What I have is a program which combines a number of invoices together as attachments, which are going to the same address. The covering email note (which I'm trying to edit) says something like "attached are your invoices". this all works fine and the invoices are all bundled into the correct email for that address.
I want to add a line to the email saying that invoice Q123454 and Q67897 are attached (so that they pick them both up, and or are not left looking for another one they may be expecting). I can get it to pick up the information from the first attachment, but not the second or subsequent ones.
it might be beyond my programing abilities

c.f. thread title: Inserting data from another source
What do you mean by "source" ?

How about showing us the program you are trying to change? In general we are better in changing things we do know about than about things we do not.

I hope this helps.

bakunin