Makes distinct file of the data plotted

The folder from which the file is selected it has all the data in one. So, to make separate file this code is used. Example, if gas data is plotted on graph then it makes the file containing only gas data.