Hi Jonny,
The general logic you are using to create a digital pulse train is fine. This VI you've written should work and will create the pulse train based on software timing (which is fine because you don't have hardware-timed DIO on the myDAQ anyway). However, it is usually good practice to start the DAQmx task just before your while loop and then clear the task after the while loop when you press stop.
For reference, there are some pretty good LV examples that I recommend looking at for this application too. If you are just trying to create a digital pulse train, the example Gen Dig Pulse Train-Continuous.vi is a good example that uses a counter to create a digital pulse train of your desired frequency. This is generally the prefered method to create a pulse train if you have the hardware available to do so (the myDAQ does have a counter). Alternatively, there are some DIO examples that continuously write to a digital line/port.
If you're not familiar, you can find the examples by going to Help >> Find Examples... in LV. Then, navigate to Hardware Input and Output >> DAQmx >> Generating Digital Pulses or Digital Generation.
Also, here is some additional information about the myDAQ and its counters:
myDAQ Counters
myDAQ Manual
Hopefully this helps.
Chris G
Applications Engineer
National Instruments