I believe you problem is because you are adding items from odd(and even in the second loops) to the same position in the total using your code line:
total[i]<- odd[j]
try this instead;
odd<- c(1,3,5,7,9,11,13,15,17,19)
even<- c(2,4,6,8,10,12,14,16,18,20)
elements = 20
total<- rep(x=0, times=elements) #20 elements
total[seq(from=1, to=length(total), by=2)] = odd
total[seq(from=2, to=length(total), by=2)] = even
total
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
seq creates a sequence of values that I have used here to identify positions to insert the values from odd and even.