That's a very complicated sketch, and too much to debug in one go. Start with the basics: Can you make each motor run forwards and backwards at the speed you want? Can you read the value of a potentiometer? You should expect to write test sketches to do each of these things in isolation and get all the different parts of your project working in isolation before you start trying to integrate them.