First of all, the 2-yo rides free. You can do this from Milan. The round trip price from Milano Centrale to Tirano is 24 EUR per adult.
Second, do not ride the official Bernina Express Train. This train requires seat reservations which costs 26 CHF per adult. Instead, ride the regular trains that go the same route. Besides not needing seat reservations, they are much less crowded and you can move from side to side as the scenery changes. The other advantage is that they have windows you can open and get better pictures, unlike on the named Bernina Express Train.
Round trip for adults on the regular train is 64 CHF. You also pay this fare on the Bernina Express in addition to the seat reservation fee. Exactly beginning 60 days before your planned travel date, you can buy a Saver Day Pass for 52 CHF per adult. this gives you the right to ride any Swiss train for that day. You must travel on that day, so you must be sure of your plan. The prices go up as you get closer to your travel and that is why you should buy it 60 days in advance when it goes on sale for your travel date. If the price is any higher, it is not worth buying. Details:
https://www.sbb.ch/en/travelcards-and-tickets/tickets-for-switzerland/day-pass/saver-day-pass.html
If you leave Milano Centrale at 8:20, you will arrive in Tirano at 10:52. The next train to St Moritz is at 11:00 from the station across the piazza from the station you arrive at. If you do miss it, not to worry, as there is another train at 11:41. You will get to St Moritz at 13:11. There is a train back to Tirano is at 13:48, and one at 14:48. Switzerland is a lot more expensive than Italy, so I recommend you pack a lunch and snacks and water.
If you get the 13:48 return train, you will arrive in Tirano at 16:23. Trains back to Milan go at 8 past the hour and the last train is at 20:08, so make sure you are back in Tirano before then. There are a couple of pizzerias near the station and prices are reasonable if you want to stop for dinner. The train ride back to Milan takes 2 hours and 32 minutes.