This event happens after Jesus was crucified and rose from the dead. Peter has gone back to fishing for fish. Jesus is again asking Peter to follow Him. After denying Jesus three times, he now states his love for Jesus three times. Peter had said in Matthew 26 that he would be willing to die for Jesus. Jesus lets him know he will indeed do that.
Despite Peter’s mistakes, Jesus still wanted Peter to follow Him and continued to have a plan for Peter’s life. It did require Peter to reconfirm his loyalty to Jesus, though. 1 John 1:9 tells us we need to confess our sins to be restored to a strong relationship with Jesus. We need to realize we have done wrong and recommit to obedience.