If one is already in a Government job, one can apply for another job BUT needs to follow the rules strictly in such circumstances. If you were in a job with a bond of 5 years in a railway job, you should have informed your appropriate senior authorities about your application for another job. Once the new job is approved you should have applied for a resignation that is likely to be a Technical resignation.
Please meet the authorities related to your first job and explain your situation. Please also read section 302 of the Rail manual that deals with resignations.(http://www.indianrailways.gov.in/railwayboard/uploads/codesmanual/est-code-I/estbl-vol1-chap3-p01-p04.htm#302). You can also meet up with a competent Service and labour lawyer who can guide you further and help you to get the resignation from the first job, pay the Railway decided penalty and then continue your second job.
You can also look at the option of the Railway employee service related grievances online platform and explain the matter clearly and ask for assistance without hiding any details .(http://www.nivaran.railnet.gov.in/nivaran/login.seam;jsessionid=CCADA86F8CFF5CD49D90E21327C777C7?type=E&cid=2382&conversationPropagation=end).
Based on the city you live, you can try and meet the Railway advocates and seek their advise (http://www.indianrailways.gov.in/railwayboard/view_section_new.jsp?lang=0&id=0,1,304,366,551,1432). This link has the clickable pdf links for the various major cities in India and the names of the railway advocates.