Section 164(3) in The Code of Criminal Procedure, 1973
(3)If at any time before the confession is recorded, the person appearing before the Magistrate states that he is not willing to make the confession, the Magistrate shall not authorise the detention of such person in police custody.