How to put specific frequency in a specific bin in frequency domain?
I ran your code, there were some errors. f_spac variable is not used after it is filled inside the for-loop. What you can do is to define a variable f_delta=1000. This will make sure the 'f' variable is filled properly with spacing of 1000 and its multiples.

N=8; 
r=1; 
f_d=1e3; 
M=4;
m=0:M-1;                
fc=0; 
%% freq spacing
for j=1:M
   f_spac(j)=(1+m(j)*r)*f_d;      %freq spacing
end
f_delta = 1000;
%% Generate the frequency vector
for i=1:M
    f(:,i)=[fc+((1+m(i)*r)/2)*f_delta; fc-((1+m(i)*r)/2)*f_delta];
end
B = reshape(f,[1,N]);
fs=20*f(N/2); % Sampling frequency
Ts=1/fs; % Sampling time
t=0:Ts:1e3*Ts; % Time vector


At the bare minimum, you need FFT size to be 8 with Fs = 4kHz. But before that you need to down-convert the signal to baseband.