Koder-S,
var marker;
google.maps.event.addListener(map, "click", function(e) {
var infoWindow = new google.maps.InfoWindow({
content: 'Latitude: ' + location.lat() + '<br />Longitude: ' + location.lng()
});
var lat =location.lat();
var lng =location.lng();
marker && marker.setMap(null);
marker = new google.maps.Marker({
position: {lat: lat, lng: lng},
map: map
});
});