Welcome to the forum
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
You could convert each character as it is read instead of trying to convert a multi digit number all at once
Or you could put each character in an array of chards as it is read, add a '\0' to the end to turn it into a C style string then use atio() to convert it to an integer
Or you could use Serial.parseInt() to do teh job for you