code that extracts attribute table from shapefile and save to csv file (from Geothon)