Deepak,
What errors exactly did you get? Are you sure the objects referenced in
Image Feature Data code are stored in repository? It would be easier to help you out if you create a small sample project and post it here for review (e.g. using keepass sample app included in Ranorex samples).
I can't be wrong, but I'm almost sure there is no "automatic" way to generate
Image Feature Data section from the code (outside Record feature). You simply need to add some images to repository and then code the appropriate content for "Image Feature Data" by yourself.
In my opinion, if Record feature is used wisely, it could save you a lot of time and energy that you would spend with writing every line of code. It's just easier to record small parts of scenario and copy/edit the generated code. This approach is especially handy if you just starting with Ranorex. You can't run before you learn how to walk
