output is seems correct then why i get errors