adds method to TaskData to add task to specific index, used for the undo function.