We investigate the formation of terrestrial planets in the late stage of planetary formation using two-planet model. At that time, the protostar has formed for about 3 Myr and the gas disk has dissipated. In the model, the perturbations from Jupiter and Saturn are considered. We also consider variations of the mass of outer planet, and the initial eccentricities and inclinations of embryos and planetesimals. Our results show that, terrestrial planets are formed in 50 Myr, and the accretion rate is about $60% - 80%$. In each simulation, 3 - 4 terrestrial planets are formed inside Jupiter with masses of $0.15 - 3.6 M_{oplus}$. In the $0.5 - 4$ AU, when the eccentricities of planetesimals are excited, planetesimals are able to accrete material from wide radial direction. The plenty of water material of the terrestrial planet in the Habitable Zone may be transferred from the farther places by this mechanism. Accretion could also happen a few times between two major planets only if the outer planet has a moderate mass and the small terrestrial planet could survive at some resonances over time scale of $10^8$ yr. In one of our simulations, com-mensurability of the orbital periods of planets is very common. Moreover, a librating-circulating 3:2 configuration of mean motion resonance is found.