Try this. Since you didn't provide f0 in your example code, I just picked some frequencies. Also, I changed to a fixed output frequency. I'm not sure what you meant to do with the calculation of the sampling frequency as a sum of the output frequencies.
f0 = [4000 6000 8000];
amp = 0.5;
Fs = 41000;
Ts = 1/Fs;
T = 0:Ts:1;
x = ;
for freq = f0
x = [ x, amp * sin(2*pi*freq*T)];
I'm not sure how this addresses the error you say you are getting, but this works for me. Since you didn't provide a full (not working) example, or provide the full text of your error message, it is difficult to know more about what was going on.
However, this code works for me.