Serial.h library question

I suggest that you read Robin's updated Serial Input Basics Tutorial to get some ideas.

Once you understand the ideas you can apply them to what you want to achieve.