Replace the title with the selected text in a note

Thank You @holroy and @Anwen , Finally it worked …

<%*
const newName = tp.file.selection();
if (newName) {
   await tp.file.rename(newName);
   tR += newName;
}
_%>