Add new rows on top and check for duplicates

I want the data from the daily API to be updated at the top of the Google Sheet row instead of the bottom. Additionally, I need a check to avoid duplicate data being added to the sheet.

I.e: I have set the limit to 20, so if the first day I receive 20 new data, and the next day 13 of them are new data, I want 13 to be added on the top of the row and 7 other ignored.