This is how it could be done:

Here a sample code of it. You can import it in a new manually triggered flow using the classic designer and the clipboard feature.
{"id":"fd73dee0-d08d-4e1d-96de-b357c5db9179","brandColor":"#8C3900","connectionReferences":{"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/9ea7e6383d7d44aba11b5e23bfd7a957"}},"shared_office365":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/1597557c9920416e9a930edfee990646"}},"shared_sharepointonline":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/shared-sharepointonl-b959cb53-5ecb-4b41-805f-06e7795a0bd2"}},"shared_teams":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_teams/connections/da0f4068677c48aba01f0613c77dcb5b"}},"shared_conversionservice":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_conversionservice/connections/shared-conversionser-c02d19aa-75cf-44e4-b0f1-c36e677a6a16"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/62947705b1a746319ca1e59aae985afc"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope_parse_file","operationDefinition":{"type":"Scope","actions":{"Compose_file_content":{"type":"Compose","inputs":"Te1-xxx~A\nTe1-xxx~B\nTe2-xxx~C\nTe3-xxx~D\nTe3-xxx~E\nTe3-xxx~F\nTe3-xxx~G","runAfter":{}},"Compose_lines":{"type":"Compose","inputs":"@split(outputs('Compose_file_content'), decodeUriComponent('%0A'))","runAfter":{"Compose_file_content":["Succeeded"]},"description":"split(outputs('Compose_file_content'), decodeUriComponent('%0A'))"},"Select_Team":{"type":"Select","inputs":{"from":"@outputs('Compose_lines')","select":"@first(split(item(), '-'))"},"runAfter":{"Compose_lines":["Succeeded"]},"description":"first(split(item(), '-'))"},"Apply_to_each_team":{"type":"Foreach","foreach":"@union(body('Select_Team'),body('Select_Team'))","actions":{"Filter_team":{"type":"Query","inputs":{"from":"@outputs('Compose_lines')","where":"@startsWith(item(), items('Apply_to_each_team'))"},"runAfter":{}},"Compose_to_show_what_to_save":{"type":"Compose","inputs":"Create file \"@{items('Apply_to_each_team')}.csv\" with content\n\n@{join(body('Filter_team'), decodeUriComponent('%0A'))}","runAfter":{"Filter_team":["Succeeded"]}}},"runAfter":{"Select_Team":["Succeeded"]},"description":"union(body('Select_Team'),body('Select_Team'))"}},"runAfter":{}}}