Section 24. If it is necessary to acquire land for the purposes of a town way or private way which is laid out, altered or relocated by the selectmen, road commissioners or other officers of a town under this chapter, such officers shall, within one hundred and twenty days after the termination of the town meeting at which the laying out, alteration or relocation of such town way or private way is accepted by the town, acquire such land by purchase or otherwise, or adopt an order for the taking of such land by eminent domain under chapter seventy-nine or institute proceedings for such taking under chapter eighty A. Any person sustaining damage in his property by the laying out, alteration or relocation of a town way or private way shall be entitled to recover the same under said chapter seventy-nine, unless such damage was sustained in connection with a taking made in proceedings instituted under said chapter eighty A, and any person sustaining damage in his property by the discontinuance of a town way or private way or by specific repairs thereon shall be entitled to recover the same under said chapter seventy-nine. If no entry has been made upon land taken under said chapter seventy-nine for the purpose of a town way, or if the location has for any other cause become void, a person who has suffered loss or been put to expense by the proceedings shall be entitled to recover indemnity therefor under said chapter seventy-nine. If a private way is laid out, relocated, altered or discontinued by a town, or if a town makes specific repairs thereon, or if a town way is discontinued, the persons upon whose application such way is laid out, relocated, altered or discontinued or upon whose application specific repairs are made thereon shall, before such way is entered upon for the purposes of construction, or is closed up, give such town security satisfactory to the selectmen that they will indemnify such town for all damages and charges which it is obliged to pay by reason thereof, and all such damages and charges shall be repaid to the town by the persons making such application; provided, however, that in case of the discontinuance of a town way the selectmen may order a part of the damages to be paid by the town. The first sentence of this section shall not apply to cities.