Identified Issue

Problem is occurring because of some mistake with variable declaration. That is why when the block is placed, the value returned is always null.