I think you should use the function as below:
function! BenIndent()
let oldLine=line('.')
normal! gg=G
execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>
Should work now I think.
Here's what I changed from your function:
fun -> function! BenIndent() " I've just always known functions to be declared this way, I may be wrong
let oldLine=line('.')
normal -> normal! gg=G " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
execute ':' . oldLine
endfun -> endfunction " just my convention
map -> nnoremap -- :call BenIndent()<CR> " noremap tells vim not to use remapped keys and n is for mapping in normal mode only, if you want in other modes change n with v, i or c etc.
prefix of ->
is your code and suffix is mine.