مَسْجِدًا بَنَاهُ refers to constructing a mosque; بَيْتًا لِابْنِ السَّبِيلِ بَنَاهُ to accommodation for a traveler in need; and نَهْرًا أَجْرَاهُ to providing flowing water. Each can bring benefit extending beyond the original donor.
Example 1: Provide a needed facility in a place of worship.
Example 2: Offer safe accommodation or essential support to travelers.
Example 3: Improve access to clean water and arrange for maintenance.
بَنَاهُ means “he built it,” while أَجْرَاهُ means “he made it flow.” In both verbs, ـهُ refers to the thing built or provided.