read the sentence below which of the following uses an infinitive in the correct way while sttil sleeping the same meaning

bill ran to the store after school buying a shirt that was on sale

Bill ran to the store after school to buy a shirt that was on sale.