I have been working on a document for some time, but now when I update the TOC, it repeats at the end of the TOC (not completely; the repeat starts at p.23)
I am unsure as to how or why this has happened, and what I can do to correct it.
Does anyone have any suggestions?
I think it can only repeat if it's 2 of them as it picks up the paragraph style to generate the TOC.
Check on page 23 and move your text frame to check to see if you have inadvertently duplicated the text frame.
Can you provide us the file to test it?
If it's not extremely sensitive - you can upload it to some sharing service and put link here.
If you don't won't to share it with the public - click on the nick name of the person and you'll see his / her profile with a button to send private message.
If @Eugene Tyson's answer won't help - there is no duplicate - how often are you doing Save As with a new name?
If very infrequently - or even not at all - maybe your file got corrupted.
In this case try IDMLing - export your document as IDML, then open this IDML file and save with a new name - do not overwrite your original INDD file!!
Try to update TOC again - in this new file.