You should probably use Data Tables to handle your data.
By simply using Generate Data Table activity you can put structure to your data. Then, you can use For Each Row activity to iterate through your Data Table and do any required operations.
Depending on your approach, you can also first use activity Build Data Table, and then activity Add Data Row that can take an array as input. It will add a row to your Data Table
See attached xaml file for actual examples of the solution TestingProject.zip (3.0 KB)
I first read the text file and create a data table, then add a row to it via user input dialogs and an array of strings and then display all the values in the log of UiPath.