Okay, so you are already creating a folder? You just need to add a file with some field values?
https://msdn.microsoft.com/en-us/library/wt3h7b61.aspx may also help you, but here is a simple code sample. Your XPath won't be my:myFields/my:field1 or my:myFields/my:field2 - right click the nodes you want data from in the data source task pane in InfoPath and select Copy XPath to get the correct XPath. Your file path is likely not D:\Documents\Temp\MyTest.txt either - so you'll want to change that. :)
Dim path As String = "D:\Documents\Temp\MyTest.txt"
' Get some values from fields
Dim s1 As String = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field1", NamespaceManager).Value
Dim s2 As String = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field2", NamespaceManager).Value
Dim lines() As String = {s1, s2}
System.IO.File.WriteAllLines(path, lines)