I assume you have somewhere in your code:
var markersArray = [CLLocationCoordinate2D]()
which defines your array of coordinates.
Your code adds points to this array as follows:
markersArray.append(formattedCoordinate)
If you want to keep coordinate “sets”, add this when you define your Array markers:
var arrayOfMarkersArrays = Array<Array<CLLocationCoordinate2D>>()
Then, by clicking the button, you can do this:
arrayOfMarkersArrays.append(markersArray)
markersArray.removeAll()
""... " "... :
// get the first "set" of coordinates
markersArray = arrayOfMarkersArrays[0]