move cursor to end of selection in a text - indesign cs3

Hi,

I’ve made a search script in Indesign cs3 which is selecting a piece of text as a result.
After that, I want to let the cursor jump to directly after the selected text.
I can’t find the right code for that part
When the cursor is at this point I want to insert an anchored object.