"Search for files in a file and write these files to another file which sould be in some other direc

Hi , Need to shell script to extracts files names and write those to another file in different directory.

input file is
inputfile.txt

abc|1|bcd.dat
123 david123
123 rudy2345
124 tinku5634
abc|1|def.dat
123 jevid123
123 qwer2345
124 ghjlk5634
abc|1|pqr.txt
123 vbjnnjh435
123 jggdy876
124 gjksda456

the output is :
output.txt

bcd.dat
123 david123
123 rudy2345
124 tinku5634
def.dat
123 jevid123
123 qwer2345
124 ghjlk5634
pqr.txt
123 vbjnnjh435
123 jggdy876
124 gjksda456

the output.txt file needs to be in some other directory.

Thanks,
Siva Santosh

your requirement is unclear... At what line you are stuck in your script ?