I don't understand, how I lost this the black pawn moved up but can't my king just eat it?
You would not lose by taking the pawn; you would draw because of stalemate. After you take the pawn with your king, Black would have no legal moves - and the Black king is not in check. Therefore, a draw.
https://support.chess.com/article/682-what-is-stalemate
I don't understand, how I lost this the black pawn moved up but can't my king just eat it?