Zain - the equations in the attached pdf indicate that you should be adding/summing the a_n from the current iteration with the a_n from the previous iteration
a_n = a_n + (6/sqrt(3))*((-1^n)/(3^n)*(2*n+1));
Same for b_n. You will also need to be careful with the order of operations and your placement of the brackets. Please confirm if the above is actually is how described in the pdf.
