How can I use a for loop to process data like the image for each serial number?

What I want to do...
1) Search for C1200
⇒ Sequentially enter S# and ID# on the newly displayed screen, one line at a time,
in sequence and submit (not including S# ID# of another Serial#)
2) Search for C1201 => same process as above
3) Search for C1205 => Same process as above
How can I repeat this kind of task?
since serial# is not always same, so I am facing the problem.