First, please use code fences.
What you need here is a timer. See Design Pattern: Motion Sensor Timer for a full discussion.
You will need to create a Script Action. Choose ECMAScript as the language. The code will look something like this:
var logger = Java.type("org.slf4j.LoggerFactory").getLogger("org.openhab.model.script.Rules.Motion Timer");
var ScriptExecution = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var now = ZonedDateTime.now();
var runme = function(){
// code that executes later goes here
this.timer = undefined; // reset the timer back to undefined
}
if(this.timer === undefined) {
this.timer = ScriptExecution.createTimer(now.plusSeconds(1), runme);
}
else {
this.timer.reschedule(now.plusSeconds(1));
}