Duplicate Inserted Row into the new table when running trigger
The statement in your trigger:

INSERT INTO temptable
   (task_name, duration)
SELECT NEW.task_name , NEW.duration
FROM task;


will insert as many rows into temptable as there are currently in task. The SELECT returns one result row for each row in task, and since the SELECT list contains only constants, all these result rows will look the same.

You want to insert a single row, so you should use

INSERT INTO temptable
   (task_name, duration)
VALUES (NEW.task_name , NEW.duration);