In this paper, two kinds of distributed time-varying formation tracking problems for a class of Lipschitz nonlinear multi-agent systems are investigated, that is, the cases with leadless and leader-following formation. By devising a new type of edge-based adaptive algorithm, the controller of each agent can avoid the use of eigenvalues of Laplacian matrix in communication networks. The proposed algorithm only utilizes local information among neighbouring agents to form time-varying formation for nonlinear multi-agent systems with mismatched nonlinearities, and the formation tracking error is uniformly ultimately bounded. To accomplish the required time-varying formation characteristic, a predesigned formation compensation function is given. Finally, numerical simulation examples are presented to indicate the stability of the proposed algorithm, and a comparison is also given to show the superiority of the given algorithm.