I’m with @Avery_Moore. I personally don’t see any reason why you couldn’t if it adds to your story, as long as you treat it with sensitivity and do your homework. Same as most religious practices. You may even find some churches are happy for you to go in and have a look if you’re respectful and they’re not being used.
There’s nothing really that weird about a confessional box really when you get right down to it. As poison mara says, they’re not sinister or shady. Some places don’t even use them any more, doing confessions face to face. But in reality they’re just a small room, the ones I’ve seen have been decently lit, usually with a grill to where the priest is so they can hear you, a quiet place where you can privately and to talk to a minister in a semi-anonomous way.
The traditional opening line is usually something along the lines of “Bless me father for I have sinned it’s been x days since my last confession…” however again, there’s really nothing that says you have to. You can simply walk in and ask the priest if you can confess a sin. It depends how traditional you or the church is. You basically talk to the the priest about anything you are genuinely repentant about and they may or may not ask you more details or talk about it in more detail. They will then give you a pennance which could be anything from hail mary’s to doing “good works” etc.