Help With Program for Line Following Robot

Rather than just "doesn't achieve the desired result" it would be more helpful if you gave some detail of what the code does and what exactly you want it to do that's different. Details of what components like motors/motor driver(s)/sensors etc you are using with a circuit diagram showing how everything is connected would also be helpful.

The first thing I notice from a quick scan of the code is that you are reading from both sensors into the same variable so sensorValue2 is always 0. Didn't you notice that from your Serial.printlns?

Steve