Why did he do that?

About 5 months ago me and my ex and I started dating again he told me he loved me and he was sorry about what happened before

we had sex a few times then he just ghosted me I started dating someone else and then he comes back saying what he said before why?
Why did he do that?
Post Opinion