Write Text Files using specific column descending such as project id

I would like it to move down the project id each iteration whilst creating a new text file with the new project id name