L298 works only when touched.

The following image is my connection of l298 with Arduino.
this is my program.

int ENA = 10; // MCU PWM Pin 10 to ENA on L298n Board
int IN1 = 9;  // MCU Digital Pin 9 to IN1 on L298n Board 
int IN2 = 8;  // MCU Digital Pin 8 to IN2 on L298n Board

int ENB = 5;  // MCU PWM Pin 5 to ENB on L298n Board
int IN3 = 7;  // MCU Digital pin 7 to IN3 on L298n Board
int IN4 = 6;  // MCU Digital pin 6 to IN4 on L298n Board

void setup()
{

  pinMode(ENA, OUTPUT); //Set all the L298n Pin to output
  pinMode(ENB, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}
void DRIVEONE()
{
  // Run the motors on both direction at fixed speed
  digitalWrite(IN1, HIGH); // Turn HIGH motor A
  digitalWrite(IN2, LOW);
  analogWrite(ENA, 200); // TO set the turning speed to 200 out of possible range 0 to 255
 
  digitalWrite(IN3, HIGH); // turn HIGH motor B
  digitalWrite(IN4, LOW);  // To set the turning speed to 200 out of possible range 0 to 255 
  analogWrite(ENB, 200);
  delay(2000);  // Delay to 2 seconds
  void loop()
{
  DRIVEONE(); 
  delay(100);
}

The program seems to work fine but the motors run only when I touch all the 15 pins in L298 as shown in the second image.
I don't understand why the motors aren't running without touching those 15 pins.

Forgot to common the grounds? Unconnected inputs?

Very likely. Make sure L298 gnd is connected to arduino gnd.

Apart from the grounds, according to the OP's pic there is no logic supply to the 298 so I'm surprised it works at all. (Or can the 298 give itself a logic supply (Vss in the datasheet from ST) from the power supply Vs?)