Sounds like a job for an Arbitrary Waveform Generator (such as the 5412), not a Function Generator.
That said, and as long as you don't need both waveforms to play back to back and the speeds are reasonably slow (like they are in your example), you can use Frequency List Mode to create two distinct Frequency Lists, each with a single step, a frequency of 20 and 50 Hz respectively and the desired durations. Select the Function type before you generate.
Hope this helps. Marcos
Marcos Kirsch Chief Software Engineer NI Driver Software