For better approach improving the function of onEdit.
Script modified
function onEdit(e) {
const ss = SpreadsheetApp.getActiveSpreadsheet();
var x = e.range.getA1Notation();
SpreadsheetApp.getActiveSpreadsheet().toast(x);
if(x == "A1:Z1000"){
ss.moveActiveSheet(ss.getNumSheets());
}
}
This condition is for the testing of your post you will need to adjust depends on your dataset also if you edit on the cell the active sheet will not moved into the last row
if(x == "A1:Z1000"){
ss.moveActiveSheet(ss.getNumSheets());
}
on this part
let sheet = ss.getSheetByName("Sheet1").copyTo(ss).activate();
This line is not needed since it will be redundant with the manual duplication your doing on the spreadsheet.