Hello,
If I understand well your question, you need to use the built-in temperature sensor of the MCU then you need to send the value over an I2C bus, right?
If yes, first read the reference manual from this link:

Then, for the I2C communication you can refer to any I2C example provided in the Cube HAL package either if it was available on your target MCU package or inspire from any other I2C example available from other CubeHaL package example: https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F411E-Discovery/Examples/I2C
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.