The literal tag is defined as a block tag. I would suggest that you use a custom tag for this instead, you can make the custom tag inline and behave the way you describe here. More information: http://www.ez.no/ez_publish/documentation/customization/components/datatypes/ezxmltext/custom_tags
If you do want to change the behaviour of the literal tag you need to change the $isBlockTag = true; to false in ezxhtmlxmloutput.php file on line 496, but I do not recommend that.