insert point/blocks at the beginning+endpoint of lines

Hello,
I have closed 2D shapes, made from many lines. I need to insert block or point at each endpoint.
Can you please tell me what's the best way?
Thank you