If you have to do this only once, you can also do this interactively in JMP (Note that JMP isn't able to capture all these steps done here, so it isn't that easy to automate based on JMP created script).
First create new column to keep the original order and sort your table descending by it

Next fix the X column values to either Numeric OR change NO to Character (I go with the X to numeric).
Then select one NO value from column track no, right click on it and select matching cells

Hold Alt and press on X column header to select X columns values which match NO value on track no

Press Ctrl + C (or otherwise copy) those values to clipboard, click on NO column header and paste them with Ctrl+V

Click on the NO column header to select all the values in it, right click on first value and fill

Sort your table again (ascending this time) with the column created in first step and delete the sorting column

And here is one more formula option using Lag (this assumes you want either characters or that you have numeric X column)
If(Mod(Row(), 5) == 0,
:X
,
Lag(:X, -1*(5 - Mod(Row(), 5)))
)
-Jarmo