You need to duplicate the task ID in each row to keep the tasks together. Or you could put the end date in a separate column and use a single row per task.