It would have been much more helpful had I made it clear that each of my individual diary entries is saved in DEVONthink with the name format yyyy-mm-dd (e.g., 2023-12-31). Obviously that script relies on that naming: sorry not to have made that clearer!
Stephen