Need help with ToDoist actions

Could you share your script/action? Very difficult to speculate without specific examples.

Have you read the Todoist integration guide? It’s probably the best place to understand the options available. I think the “Tasks in Todoist” example in that guide is probably the best place to start - you would just need to add some logic to identify and route the different custom markup you are using when looping over lines.