Q:

Linux adding filename and path to text file on a single line

I'm trying to write a script to add the name of a file and the directory path to a text file on a single line.
E.g.
Filename /root/folder/folder/

I've tried:
ls "$1" >> /root/folder/folder/file.txt
pwd >> /root/folder/folder/file.txt

But it shows up on seperate lines.
I did try
ls "$1" && pwd >> ...... 

but it only pasted the pwd to the text file.
I'm new to Linux so any help would be greatly appreciated.

A:

How about this:
echo "$1 $(pwd)" >> outputfile

