refactored astar
wrote getLine function