I'm so frustrated?

My puppy was doing so good by going outside yesterday. Only had a few accidents in the house. He's 3 months
I was in and out of the house with him today got 20 mins 2 separate times. It was cold out and I didn't want to stand out there forever. He kept jumping up on me not going to the bathroom then immediately I put him in his pen and he pees and poops, twice.

I feel so dumb, he was doing so good! I was praising him with treats. I'm just so frustrated and I know it's not his fault. He's still a puppy. He's been urinating outside but been pooping inside so that's another thing that's upsetting..
he was outside in and out for an hour and i let him in his pen and he immediately pees again. :( I hope he gets it eventually. .
I brought him Inside again and put him in his crate and he peed and he was outside I brought him in and peed in his pen.
He did go out ONCE today. And I gave him a reward. I've had him a month, does this get easier? :(
I'm such a failure. He poops and pees in the house. It's not his fault its mine. But I'm so dumb. I should've had some success. He's 3 months, he should know enough now. :( I don't want the house to smell like dog pee and poop.

I don't know nothing is working. I took a mat he's been peeing on outside and it's been 30 minutes. He still hasn't gone, but as soon as I put him in his pen, he goes. We just started going out in the yard today. I have his mat out there still that has his scent on it.

I broke down crying.. I know it's ridiculous. But it's pretty frustrating, he's a good dog.. is anyone else dealing or dealt with this?
Updates
1 y
I watched so many YouTube videos, and everything. I tried the leash, he just chews at the leash or gets distracted by leaves.
I'm so frustrated?
Post Opinion