Your syntax is a bit awkward. If you used this, then it would likely work. That said, it is 'getting' the list of notes each cycle. This isn't inherently bad but it's not good and could modify the results.
delete item 2 of (get notes)
Some things to consider:
Try using a list to represent the notes
. As you delete notes, the contents of notes
changes so the results should be more predictable when you work from a static list. For example, this should also work.
set nList to notes
delete item 2 of nList
Generally, if you can do things that are unrelated to the application in question, try and do them outside of the tell block. In this case, calculating a date is unrelated so set it beforehand.
Since all of the notes to delete are within the same folder, loop through that folder rather than through every note. You can remove the related if…then statement.
To help track the deleted notes, I added 'xList' to record those being deleted. When run from Script Editor, the list will appear in the Result. If you plan on running it in some other manner, you would need to explicitly provide the results (e.g. display dialog, save item names to text file). Of course, all of the deleted notes should appear in the 'recently deleted' folder but so would any other recently deleted note which might skew your understanding of what the script deleted.
This should achieve your purpose:
set cutoffDate to (current date) - (14 * days)
tell application "Notes"
set mainFolder to folder "Notes"
set nList to notes of mainFolder
set xList to {}
repeat with aNote in nList
if (creation date) of aNote is less than cutoffDate then
set end of xList to name of aNote
delete aNote
end if
end repeat
xList -- list of deleted notes
end tell