Shell script / Grep / Awk to variable and Loop

Hi,

I have a text file with data in that I wish to extract, assign to a variable and process through a loop.

Kind of the process that I am after:

1: Grep the text file for the values.
Currently using:
cat /root/test.txt | grep TESTING= | awk -F"=" '{ a[i\+\+] = $2 } {print a[1]}' | sort -u

This will print out the first value. (Change the print to then print the second, print a[2] )

2: Assign all occurences of my extracted value to a variable.

3: With each occurrence/ variable pass it through a loop and use it to locate/extract more information.

4: The information will then be output to another file.

For example.

Test.txt content:

Hello Mum
TESTING=FortyFive
Hello World
TESTING=IO432

Assign both grep'd/awk'd data to a variable, because for each it needs to loop through more grep/awk's to find more data.

I want to extract and display in my output file:

TESTING::FortyFive,IO432
TESTED::More extracted data,Even more data
AGAIN::Still more, and again

Therefore the data before the comma related to the first value, FortyFive, the data after the comma in the output file refers to the second value, IO432.

I hope you can understand what I am trying to do.

Hope someone can help.