Hello,
It looks to me like you've got a somewhat complicated string parsing algorithm here to implement. Something you might consider is using a table to help you organize your data. A table in LabVIEW is nothing more than an array of strings -- typically a 2-D array of strings. If we start with the string you originally posted, we can convert this into a 1D array of strings. One way you could accomplish this is by using the Match Pattern VI to identify where each of the new line characters ('\n') are in the string.
From here, you can use array manipulation VI's to organize your 2D table. Scan through each each cell in your original 1D array of strings. As you come to a different termination number (0 or 1) you can begin a new column in the table.
There are of course several ways you could implement an alogorithm to parse your data. I only offer a table a suggestion. You'll have to flatten it all back into a single string if you wish, but I'll leave these decisions to you. If you have more specific questions, I'm happy help answer them.
Thanks!