A long-established football club are to take control of their home turf thanks to an arrangement with South Lanarkshire Council.