add the edited task at the same index
fixed logic for adding task in empty list
simplify search methods