Coordinate Text block

Does anyone know of a script that will write the XY coordinates for a point to a text block?

Here is an example of what I need to do.

Thanks