How does a diatomic molecule vibrate in response to heat?
The diatomic can vibrate only by extending and contracting the bond. The more energy that is added the bigger the bond excursion. (More vibrational levels are excited and have bigger excursions). The bond only extends by a few % of its length in lower vibrational levels so its pretty hard to see. If heaps &amp; heaps of energy are added (temp say $1000$ K) then in a real molecule the bond can break as it is actually anharmonic in its motion. When this happens the atoms fly apart. 

Additionally the molecule can also rotate while it is vibrating. Rotation is a slower motion than vibration so many vibrational periods occur within a $360$ degree rotation.

At any given constant temperature in a sample of molecules the energy moves between vibrations, rotations and translations so that each type of energy is in equilibrium. 

Some of the energy can  also be transferred as  radiation, in the infra-red (for vibrations hundreds to a few thousand $\pu{cm^{-1}}$) and microwave region ( in the range few $\pu{cm^{-1}}$) for rotational transitions but only if the diatomic molecule has a permanent dipole, i.e. is not homonuclear. If these molecules are in equilibrium with surrounding then these surroundings must also emit/absorb radiation to keep the total energy constant. If you were to suddenly isolate your block of (heteronuclear diatomic) molecules, say in space, then the radiation emitted would over a few hours remove energy so that the molecules will end up in their zero point levels. 

The figure shows the potential energy profile of HI. The the average length for the for the lowest level (quantum number $0$) is approx $106.4 $ pm and the chnage due to vibration is about $\pm 10 $ pm and clearly greater for higher vibrational levels. The vibrational period is $\approx 14 $ fs.