He doesn't know it's a safe space to do it outside yet - they feel vulnerable when going to the toilet, can't run from the monsters, so will default to a safe space. Inside will have been his safe space for all of his life so far.
Can you find or create a smaller space outside? near to wall/fence so he feels more secure?
Mine is 14 weeks now and still catches me out, took her out to the loo at 5:30 am when she woke me with a face wash (she sleeps on my bed) I noticed no wee in the hallway, which she has access to, so expected her to go as soon as the door was opened - but she didn't, so I knew there was one lurking inside for me to step on - she'd gone in the kitchen.
My toilet training is complicated by having three other dogs who are used to having "access all areas" (and one is elderly and sometimes incontinent).
I've had some dogs take longer than others to "get it" but they really all do get there in the end if you are consistent with praise (when you can catch them doing it!). Libi didn't do a poo on her morning walk - so I know I must have missed her going in the garden when I was clearing up in the kitchen after they'd been fed. You need eyes in the back of your head!