In this situation he suppose to made the Niyat of the qadha if there was any if there is no qadha then make the Niyat of qurbat . If he was not aware of the masala In’Sha’Allah Allah will reward him for his effort but not transfer to the qadha because he has not intended for the qadha.