how to change this code to control 2 stepper motors ?

I suggest you don't start with that code. All those delay()s are going to make it almost impossible to get sensible movement from 2 motors.

Post a link to the datasheet for the stepper motors you are using. And tell us what stepper motor drivers you are using.

Have a look at these links
Stepper Motor Basics
Simple Stepper Code

also look up the AccelStepper library

For receiving data to control the motors have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

...R