MacOS Automator: Save new text file in current folder I am trying to write a simple Automator service to merge selected text files. I’ve nearly got it, but I am running into one problem.

I want to create a new text file from the combined output of the selected files. When I add the New Text File action, I can only set the Where location to a particular folder.

If I want to create a new folder, I have the option of Same Folder as Input. This does not appear for new text files.

How can I save a new text file to the same folder as the selected files?
Since you did not include your workflow, what type of workflow it is, or which version of OS X/macOS you're using, I can only offer an example of how you can set a variable to use for the Where: in a New Text File action in an Automator workflow. 

I have a Temp folder, which I created, in the root the Macintosh HD, and in this folder I created two plain text files, named Filename1.txt and Filename2.txt, each of which contain a single line of text, "The name of this file is Filename1.txt" and "The name of this file is Filename2.txt", respectively.

The following Automator workflow works with selected Finder items in Finder's frontmost window, or the Desktop as appropriate if no other individual Finder windows are frontmost with a selection, and using a Run AppleScript action sets a variable to the parent folder of the first item selected to be used as the Where: in a New Text File action. and creates a file named Combined.txt.

Note in the image below, there is a break in the link between the Set Value of Variable action and what is the second Get Selected Finders Item action.  This disconnect is created by selecting Ignore this action's input under Options in the second Get Selected Finders Item action.

The variable inputParentFolder was dragged and dropped from the Variable section at the bottom of the workflow pane into the Where: in the New Text File action.

As you can see in the image below, the workflow completed successfully combining the content of the two selected files in Finder into a new file named Combined.txt in the same folder as the selected files.