If you know ahead of time what kind of signal to output, pre_generate it and then output it using one of the examples of buffered generation.
A problem with timed loop may arise if the time it takes to execute the Analog output write command is way more than 0.02 seocnds (which can be the case)