I've tried the following, but it doesn't work.
inoremap <C-\> <Esc>$a<Space>do<Space><Bar><Bar><CR>end<Esc>k$i
I'm trying to map a shortcut for ruby
do || .. end blocks.
If I understood your question correctly, you want to insert some boilerplate code. There are several ways to approach this:
Hope this helps.