ask a question about if command

That command is not run every timestep which it seems like you think. Basically, it will evaluate nstep at the time of the command (nstep may be zero then) and evaluate to false and go on to the next command.

If you want a dump at that specific timestep, you can do

run 50017 # Run to this timestep
write_dump all custom configuration_*.dat id type x y z # Write dump file

run 100000 # Continue simulation

Or something like that.