Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me .
Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer.
I want to create a mutiple output files with each file having a seperate code which is stored in text file and create XYZ_222_999_YYYYMMDD_1.TXT . and add date in the contents next to series of numbers .Like this
Before change the file looks like this
file name XYZ_111_999_YYYYMMDD_1.TXT
001,19SEP2009-14:05:05,000000003
1234
4567
6785
END_OF_DATA
Output file should be as below
XYZ_222_111_YYYYMMDD_1.TXT where 222 will be from stored list or text file
001,222,19SEP2009-14:05:05,000000003
1234,19SEP2009-14:05:05,222
4567,19SEP2009-14:05:05,222
6785,19SEP2009-14:05:05,222
END_OF_DATA

List file will be as below
test.txt
222
333
444
555
666

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

Thank you Franklin52 .but I didn't inscribe any code in my post . I have added the values i want to extract and change. Can you Please post this