how to use arduino PID library?

i am new to arduino programming and i want to use the PID library as i am using a motor with position encoder, the example provided on the arduino PID website is confusing
my current code is :

#include <PID_v1.h>

//Define Variables we’ll be connecting to
double Setpoint, Input, Output;
int countA=0;
int last_A;
float error_A, error_int_A, error_calc_A, D_A;
int forward = 9;
int backward = 7;
int pwm = 10;
int directionForward = 5;
int directionBackward = 2;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,5,0,30, DIRECT);

void setup()
{ //mototA
pinMode(pwm, OUTPUT);
pinMode(forward, OUTPUT);
pinMode(backward, OUTPUT);
pinMode(directionBackward , INPUT);
pinMode(directionForward , INPUT);
attachInterrupt(digitalPinToInterrupt(directionBackward ), pulseCountA, RISING);

//initialize the variables we’re linked to
Input = digitalRead(5);
Setpoint = 100;
// SetOutputLimits(-255, 255);
//turn the PID on

void loop()

Input = digitalRead(5);

digitalWrite(backward, HIGH);
digitalWrite(forward, LOW);
Serial.print("countA: "); Serial.println(countA);


but the code is not performing as needed, instead my motor just runs contieously to position 6000 and does not stop at 100.
can anyone help please? or share code?

also, one more question
how do i use the arduino autoTune library?