Hi there and thanks for the post.
I guarantee you i won't yell or tell you off because you haven't been doing anything wrong
It is very hard to fix these sort of problems when your puppy won't give you any warning. Just to make sure he doesn't give you any warning it may be a minor thing like a whimper, a look or following you around a lot.
When you are at home try and take him out as much as possible. That means every hour as well as before and after feeding and playing. The fix to the problem is getting him to his toilet area more often....not trying to stop the accidents as such.
What you are doing when you find he has made an accident is perfect. Make sure that when you clean up the mess that you use the paper etc to put in his normal toilet place.
Also it is really important to use a good deodouriser when he messes. Removing the smell will stop him from making it a habit to toilet in the same area over and over again.
When you do take him out ignore him and wait. If after a few minutes he hasn't done anything take him back inside and try again later.
The reason he may be toileting is due to being young. Just like children puppies need time to develop bladder control and this is something that will keep developing

When you pet him he may relax so much that accidents happen so try and pet him for shorter periods but more often. This may help.
It may seem frustrating that there is no straight forward way to fix it. But time and mroe frequent toilet trips are the way to go.
Please let me know how things go and if i can help anymore
Todd