@Vimal – this is the wrong forum for questions like that (ExtendScript scripting). There is a dedicated forum here around:
But before someone is moving this thread over, let me ask you some questions:
1. Why is page number 248 a double entry in both arrays at the start of your script?
2. Do you want to make all numbers unique?
Now moved to the scripting forum....
If you don't mind "borrowing" code from someone else, this might be interesting for you:
You were very close, the only problem is that you got .splice() wrong. Instead of
The first argument of splice() is a position, not some content.