In shiva Mahapuranam, Koti Rudra Samhita chapter, it tells about how Baidyanath Jyothirlinga came into existence.
Ravana Does Tremendous Penance
Once king Ravana did a tremendous penance to please lord Shiva to get a boon from him.
Even after his severe penance when lord Shiva did still not appear, he started offering his heads one by one to lord Shiva. This way he already severed his nine heads and offered them to Shiva. When he was about to severe his last remaining head, just then lord Shiva appeared before him. He blessed Ravana with unparalleled power and strength. Lord Shiva also made him a ten headed demon once again. But Ravana was not satisfied. He requested lord Shiva to come along with him to Lanka(Present Sri Lankha). Lord Shiva gave Ravana Shivalinga and warned him against keeping it on the earth, as then no power on the earth could lift that Shivalinga from there.
How Baidyanath Jyothirlinga came into exsistence
Ravana proceeded with the Shivalinga. On the way he felt the urge of urinate. Ravana gave that Shivalinga to a cowherd boy and went to urinate. The cowherd boy held the Shivalinga for sometime. He felt that the Shivalinga was becoming heavier and heavier. He could not bear the weight of the Shivalinga for too long. He kept it on the ground. When Ravana returned he became very sad after seeing the Shivalinga on the ground. He knew that, now it was impossible to lift it from that place. Ravana established the Shivalinga there(Present Deoghar , Jharkhand), which became famous as