How to synchronize a DAC?
You're writing values out to the DAC in a loop as fast as the CPU/bus will let you, with no connection to the rate they're coming in. You need to use a timer to clock them out at a controlled rate, or maybe a DMA. If the source and destination are in the same clock domain, and you manage your code properly (making sure things run in close to constant time) you should be able to run the input and output in lockstep without any glitches.