Many piano students practice like this.
They play their pieces from beginning to end. Again and again and again. If there are mistakes, they will glide through them or correct them on the spot.
Or if there is a difficult problem to be untangled, frustration will win the day and practice will come to an end.
The solution to this is simple. Find the smallest breakthrough.
If a new piece is overwhelming, start with the first phrase. Maybe that's the first eight bars.
If that's too much, start with four.
If that's too much, start with two.
If that's too much, start with one.
See where I'm going with this? No matter how difficult a piece of music, there's always some small amount of it you can play well.
That smallest breakthrough is a seed. And from there, your work can grow as you build a piece of music together bit by bit.
Find enough small breakthroughs, and you build momentum.
Build enough momentum, and wondrous things happen. Maybe even things you never thought possible before.