how is potentiometer used to measure internal resistance of any cell
The electromotive force (emf) of a cell is its terminal voltage when no current is flowing through it. The terminal voltage of a cell is the potential difference between its electrodes. A voltmeter cannot be used to measure the emf of a cell because a voltmeter draws some current from the cell. To measure a cell's emf a potentiometer is used since in a potentiometer measurement no current is flowing. It employs a null method of measuring potential difference, so that when a balance is reached and the reading is being taken, no current is drawn from the source to be measured.
This is the basic circuit diagram for a potentiometer. Point C is the sliding contact which can be adjusted for zero current deflection through the galvanometer.
In this method (refer to Figure 1) a uniform, bare slide wire AB is connected across the power supply. If you were to connect a voltmeter between the + power supply terminal and point A you would measure essentially zero volts. If you were to now connect the voltmeter between the + power supply and point B you would measure a voltage equal to the terminal voltage of the power supply which is approximately 2.5 volts. The potential relative to point A then varies from zero at A to approximately 2.5 volts at B.
The cell whose emf is to be determined is then connected so that its emf opposes the potential along the wire. At some point C the potential difference between A and C is exactly equal to the emf of the cell so that if the other terminal of the cell is connected to the point C, no current will flow. The calibration procedure is to locate this point C using a standard cell whose emf is accurately known (emf = 1.0186 volts). You then know that at this point C the potential difference relative to point A is exactly 1.0186 volts.
Since the wire is uniform, the length of wire spanned is proportional to the potential drop and the wire can now be calibrated in volts per cm. The emf of an unknown cell is then found by finding a new point C whose potential is exactly equal to the emf of the unknown cell and multiplying this new distance AC times the calibration factor determined using the standard cell.