FileWrite.

The following program creates and writes a file.

.386 
.model flat,stdcall 
option casemap:none 
include \masm32\include\windows.inc 
include \masm32\include\kernel32.inc 
includelib \masm32\lib\kernel32.lib 
include \masm32\include\user32.inc 
includelib \masm32\lib\user32.lib 

.data 
filename DB "output.txt", 0
buffer   DB "Hello, world!", 0

.code 
main PROC

INVOKE CreateFile,
            ADDR filename,  
            GENERIC_WRITE,
            0,
            NULL,
            CREATE_NEW,
            FILE_ATTRIBUTE_NORMAL,
            NULL

    ; Error check.
    .IF EAX == INVALID_HANDLE_VALUE
        INVOKE ExitProcess, 1
    .ENDIF

    ; Writing to file.
    INVOKE WriteFile,
            EAX,                   ; File handle
            ADDR buffer,           ; Address of data.
            LENGTHOF buffer,       ; Number of bytes to be written
            0,                     ; Number of bytes written (output parameter)
            NULL                   ; Overlap information (not used)

    ; Close file.
    INVOKE CloseHandle, EAX

    invoke ExitProcess,NULL
main ENDP
END main

Compile and run:
Link : How to compile our console assebmly file, using MASM32.

The output.txt file will be created as a result of the run, open it and check, that "Hello World!" does it include.