Hi batata004,
I am using NEMA 16 motor with A4988 driver
good to see, you got it working at least a little bit (without even adjusting the current by measuring) ![]()
If your motor gets too less current at a given required torque situation, it will miss steps.
Depending on the given environment the stepper is in, you might need a library which adds acceleration/deceleration (ramp-up/ramp-down as @Robin2 said); so have a look at the AccelStepper library. Be adviced that the maximum speed is limited to 4000 steps/sec with that library. Unless your project needs to exceed this limit, you will be fine with this library.