Complex sentence: Tootle then sees Bill with a green flag over the railings and having learned his lesson gets back on the track and says that playing in the meadow only brings red flags to trains.
Split into simpler sentences: Tootle then sees Bill with a green flag over the rails. Having learned his lesson, Tootle gets back on the track and says that playing in the meadow only brings red flags to trains.