Do it this way, where:
FileX is your sample file X
FileY is your sample file Y
FileZ is your sample file Z
MyNewFile is your New generated file


Drop a button on a form, and make sure that you edit the file names and click the button to do the stuff.


Code:
Declaration Section
Option Explicit
Dim FileXData As String
Dim FileYData As String
Dim FileZData As String
Dim Buffer As String


Sub Form_Load()
'form load event

  'edit these filenames or 
  'create test files in the relavent folder
  FileXData="c:\temp\testfileX.txt"
  FileYData="c:\temp\testfileY.txt"
  FileZData="c:\temp\testfileZ.txt"
  'this is the results file which will be created
  MyNewFile="c:\temp\testresults.txt"

End Sub


Sub Command1_Click()
'command button click event

'init buffers
Open FileX For Output As #1
Open FileY For Output As #2
Open FileZ For Output As #3
Open MyNewFile For Output As #4

'start with file x
FileXData=input#(FileLen(FileX),1)

'do file Y Next
FileYData=input#(FileLen(FileY),2)

'do file Z Next
FileZData=input#(FileLen(FileZ),3)

'--> parse the file so as to comma delimit it
ParseMyFiles()

'-->  now your ready to write it out
'do file x
Msgbox "Writing File X Header"
Write #4,"--> File X Header"
Write #4, FileXData
Write #4,"--> End File X Header"

'do file y
Msgbox "Writing File Y Header"
Write #4,"--> File Y Header"
Write #4, FileYData
Write #4,"--> End File Y Header"

'do file z
Msgbox "Writing File Z Header"
Write #4,"--> File Z Header"
Write #4, FileZData
Write #4,"--> End File Z Header"

'close all buffers
Close #1
close #2
Close #3
Close #4

End Sub


Sub ParseMyFiles()
'does comma delimiting

'the simplest way (as coding goes) is to search each file
'for spaces, and this is where the comma will be placed
'
'so:- Cats Dogs Mice would become
'     Cats,Dogs,Mice etc etc
Dim Counta As Integer

  'file x first
  Buffer=""
  For Counta = 1 to Len(FileXData)
    'test for space
    If Mid$(FileXData,Counta,1)=" " Then
      'make change/delimit
      Buffer = Buffer & ","
    Else 
      Buffer = Buffer & Mid$(FileXData,Counta,1)
    End If
  Next
  'update string
  FileXData=Buffer

  'file y
  Buffer=""
  For Counta = 1 to Len(FileYData)
    'test for space
    If Mid$(FileYData,Counta,1)=" " Then
      'make change/delimit
      Buffer = Buffer & ","
    Else 
      Buffer = Buffer & Mid$(FileYData,Counta,1)
    End If
  Next
  'update string
  FileYData=Buffer

  'file z
  Buffer=""
  For Counta = 1 to Len(FileZData)
    'test for space
    If Mid$(FileZData,Counta,1)=" " Then
      'make change/delimit
      Buffer = Buffer & ","
    Else 
      Buffer = Buffer & Mid$(FileZData,Counta,1)
    End If
  Next
  'update string
  FileZData=Buffer

End Sub
I know the code could be condensed but have kept it longhand so you can decipher what each line of code does.

DocZaf
{;->