The proper solution is to create an event driven VI.
The interface would have two buttons: one to generate a pulse and one to stop the program.
The pulse generation hardware would be initialized before entering the event loop.
Inside the loop: When the generate pulse button was pressed, code would be executed that would produce one pulse. When the stop button was pressed, the code would deinitialize the pulse generation hardware and stop the loop.
Check the examples for information on event-driven programming, then ask more questions is you have any.
Mike...