N20 Motor Rotary Encoder Counting Problem

Back to the basic question

Should I use 2 pins of Encoder?

You presumably know the motor direction so you just need to count pulses on one encoder pin and add/subtract to/from the count according to the motor direction.

If you use both encoder pins you can determine the direction, but if you are controlling the motor this should not be necessary and is only usually used to read an externally driven encoder.