fg_write is a function that takes an ASL object representing a problem instance and writes it to an .nl file. It doesn't transform AMPL file into an .nl file, for that you need the AMPL translator.
This fg_write function is a part of AMPL Solver Library (ASL) which can be compiled on Windows, for example, with CMake and Visual Studio or msbuild:
cd ampl
cmake .
msbuild /p:Configuration=Release AMPL.sln
The built AMPL Solver Library (amplsolver.lib) will be placed in the solvers/Release directory.
HTH,
Victor