The file input adds a "path" field to the event. If you want to use the same name in a different directory as the output then you could
mutate { add_field => { "filename" => "%{path}" } }
mutate { gsub => [ "filename", "^.*/", "" ] }
and then reference that field in the output
output { file { path => "/some/path/%{filename}" } }