create element outside loop