How can I create a rule that automatically sorts new rows by date?

When a new row is added automatically based on the date via an automated function, it is placed at the bottom of my sheet, while all existing rows are sorted by date. How can I create a rule that automatically sorts new rows by date?

Answers